php - How to fetch data from another table within a Zend_Db model class? -


I have two tables registries and names . As a result, I have two model classes. I am codifying a method in the Registry model and I need to bring all the names in the table / model. How do i

Should a simple new name () work? But, is it recommended?

Yes, to make this an example possible is another table class Under the table of the other table classes.

But if you have included several tables to apply, it would be better to design a category that works for that application, and uses both tables from it.

This is the reason why it is wrong to call a table to a model. Zend_Db_Table Nowhere in the documentation is a table called a model.

A model shows some parts of your application, and can be included in this task to make several tables in it


Redo your comment: Still thinking that a model is expanded Zend_Db_Table_Abstract - it is not!

A model not is a data access class, it is a unit of your application, it does not extend any part of the Zend Framework.

The relationship between the model and the table is hash-e , IS-A .

  class MyRegistryModel // nothing spreads {/ ** * @ War Zend_Db_Table_Abstract * / protected $ _registryTable; / ** * @WerZend_Db_Table_Abstract * / protected $ _namesTable; Public function __ composition () {$ this- & gt; _registryTable = New Registry tab (); $ This- & gt; _namesTable = New NameTable (); } Public Function getDailyReport () {// Use the tables required to create the report}}  

Comments