Zend Framework

Zend DbTable Row Class name->path problem

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.0
  • Fix Version/s: None
  • Component/s: Zend_Db_Table
  • Labels:
    None

Description

I was using Zend_Application_Module_Autoloader to autoload my resources.
I created two classes one extending Zend_Db_Table_Abstract (Users) and the other is a custom row class extending Zend_Db_Table_Row_Abstract (User).

When instantiating these class separately there is no problem. However when I use Table class like with a custom row like the one below. It cant find the file. It looks in "model" directory instead of "models";

class Model_DbTable_Users extends Zend_Db_Table_Abstract
{
protected $_name ='user';
protected $_primary = 'id';
protected $_rowClass = 'Model_DbTable_User';
}

I am guessing there is a separate Namespace/path converter somewhere else and it is converting differently than Autoloader.
This may be helpful
\library\Zend\Db\Table\Rowset\Abstract.php(119): Zend_Loader::loadClass('Model_DbRow_Use...')

There is a discussion about this at http://www.nabble.com/Zend-Model-and-quickstart-tt23445168.html

Issue Links

Activity

Hide
Matthew Weier O'Phinney added a comment -

The problem is not that it's looking in the wrong directory so much as it's not using autoloading – which is an issue throughout the framework currently. We'll be addressing it soon.

Show
Matthew Weier O'Phinney added a comment - The problem is not that it's looking in the wrong directory so much as it's not using autoloading – which is an issue throughout the framework currently. We'll be addressing it soon.
Hide
Sinan Taga added a comment -

Any tips on how to fix this?

Show
Sinan Taga added a comment - Any tips on how to fix this?
Hide
Matthew Weier O'Phinney added a comment -

Resolved in trunk and 1.8 release branch

Show
Matthew Weier O'Phinney added a comment - Resolved in trunk and 1.8 release branch
Hide
Sinan Taga added a comment -

I downloaded the from the trunk to give it a try. As you said it now works. However there is another problem (or I'm doing something wrong) which may be related.

Anyway:
It seems that even if you set a new rowClass in the table class when you return it, thr returned object is still Zend_Db_Table_Row Object instead of the custom class.

Doesnt work...
// Specify a custom Row to be used by default
// in all instances of a Table class.
class Products extends Zend_Db_Table_Abstract
{
protected $_name = 'products';
protected $_rowClass = 'MyRow';
}

Does Work
// Or specify a custom Row to be used in one
// instance of a Table class.
$bugs = new Bugs(array('rowClass' => 'MyRow'));

Show
Sinan Taga added a comment - I downloaded the from the trunk to give it a try. As you said it now works. However there is another problem (or I'm doing something wrong) which may be related. Anyway: It seems that even if you set a new rowClass in the table class when you return it, thr returned object is still Zend_Db_Table_Row Object instead of the custom class. Doesnt work... // Specify a custom Row to be used by default // in all instances of a Table class. class Products extends Zend_Db_Table_Abstract { protected $_name = 'products'; protected $_rowClass = 'MyRow'; } Does Work // Or specify a custom Row to be used in one // instance of a Table class. $bugs = new Bugs(array('rowClass' => 'MyRow'));

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: