Yo need to call parent's costructor to initialize the object before
using the find method.

I think the constructor doesn't return any value, so this should work:

public function __construct()
{
        parent::__construct();
        $this->_acc = $this->getCurrentAccount();
}

lun, 12-04-2010 a las 05:29 -0800, milesap escribió:
> I have an account model like so:
> 
> <?php
> 
> class Account extends Zend_Db_Table_Abstract
> {
>       protected $_name = 'account';
> 
>         public function __construct()
>       {
>               $this->_acc = $this->getCurrentAccount();
>               return parent::__construct();
>       }
> 
>         public function getCurrentAccount()
>       {
>               $auth = Zend_Auth::getInstance();
>               $data = $auth->getIdentity();   
>               return $this->find($data['id'])->current();
>       }
> . . . more
> }
> 
> and a create account model which extends the account model:
> 
> class Account_Create extends Account
> {
>       public function __construct()
>       {
>               return parent::__construct();
>       }
> . . . more
> }
> 
> I get the following error message:
> Fatal error:  Call to a member function describeTable() on a non-object in
> /Applications/MAMP/Library/Zend/Db/Table/Abstract.php on line 814
> 
> I know for a fact that this error is caused by the __construct method, if I
> remove the line '$this->_acc = $this->getCurrentAccount();' the error goes
> away. Am I doing anything wrong here? Thanks so much!
> 
>       

-- 
Alayn Gortazar
Irontec, Internet y Sistemas sobre GNU/LinuX - http://www.irontec.com
+34 94.404.81.82


Reply via email to