-- Jason DeBord <[email protected]> wrote (on Friday, 13 February 2009, 09:02 AM +0100): > In the ZF Documentation regarding the Zend_Db_Table_Abstract, the > instructions regarding init() state: > > class Bugs extends Zend_Db_Table_Abstract > { > protected $_observer; > > protected function init() > { > $this->_observer = new MyObserverClass(); > } > > However when I use "protected" for my init() function, I get the > following error: > > Fatal error: Access level to Events::init() must be public (as in > class Zend_Db_Table_Abstract) in > > Am I doing something wrong somewhere or is the documentation wrong/outdated?
The docs are outdated. The method is declared public in Zend_Db_Table_Abstract, and PHP's object model only allows you to declare visibility of a method when overriding to a visibility the same or less restrictive than the parent class. I've corrected it in trunk, and the change should appear with the next release. > This is in my bootstrap if it matters: > > // DATABASE ADAPTER - Setup the database adapter > $dbAdapter = Zend_Db::factory($configuration->database); > > // DATABASE TABLE SETUP - Setup the Database Table Adapter > Zend_Db_Table_Abstract::setDefaultAdapter($dbAdapter); -- Matthew Weier O'Phinney Software Architect | [email protected] Zend Framework | http://framework.zend.com/
