I couldn't figure out how to open a new issue, so I'm post this to the list.
I needed to add some functionality to Zend_Mail_Part to improve upon a mail parser for work. In order to get the Storage object to use my new Part object I had to jump through many hoops to get it all to work. The following code fragments illustrate how I managed to get it to work: //storage object require_once ('Zend/Mail/Storage/Imap.php'); class My_Mail_Storage_Imap extends Zend_Mail_Storage_Imap { protected $_messageClass = 'My_Mail_Message'; } //message object require_once 'My/Mail/Part.php'; class My_Mail_Message extends My_Mail_Part { ...exact copy of Zend_Mail_Message violating DRY... } //part object require_once ('Zend/Mail/Part.php'); class My_Mail_Part extends Zend_Mail_Part { protected function _cacheContent() { // caching content if we can't fetch parts if ($this->_content === null && $this->_mail) { $this->_content = $this->_mail->getRawContent($this->_messageNum); } if (!$this->isMultipart()) { return; } // split content in parts $boundary = $this->getHeaderField('content-type', 'boundary'); if (!$boundary) { /** * @see Zend_Mail_Exception */ require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception('no boundary found in content type to split message'); } $parts = Zend_Mime_Decode::splitMessageStruct($this->_content, $boundary); $counter = 1; // WORKAROUND Early Binding Issue: ZF-3745 $classname = get_class($this); foreach ($parts as $part) { $this->_parts[$counter++] = new $classname(array('headers' => $part['header'], 'content' => $part['body'])); } } public function myNewMethod() {...} } Notice I had to make a duplicate class for My_Mail_Message which is an exact copy of Zend_Mail_Message save for the extends My_Mail_Part. Also due to early binding I had to duplicate Zend_Mail_Part::_cacheContent() in My_Mail_Part and implement a work around to get it to return my new class vs. Zend_Mail_Part. This seems more difficult than it should be. Extending these components so we can add functionality or tailor their implementation should be much easier than this. If I didn't have Nico on irc helping me I would still be stuck. There is an issue open for the early binding bit, but that sill leaves us having to duplicate Zend_Mail_Message in order to get an extended object chain working. Either that or the docs need to be updated with how accomplish using an extended Mail_Part class without having to jump through these hoops. Thanks -- View this message in context: http://www.nabble.com/Extending-Zend_Mail_Part-for-Reading-tp18641268p18641268.html Sent from the Zend Framework mailing list archive at Nabble.com.