database - Zend Many to Many Relationship -


I want to retrieve all data from 3 tables

users, properties, and users_properties.

So I decided that I would use many Tomarvivets. But I'm surprised that I get data from the property and user_properties table but no data is found from the user table. Why is it like this? I need some columns from the user table, is there a way to tell the many tetmanyrostet functions that I also need data from the current table?

This is my function

  public function fetchRegisteredProperties () {$ userTable = $ this- & gt; GetTable (); Require_once APPLICATION_PATH '/models/DbTable/UsersPropertiesDB.php'; Require_once APPLICATION_PATH '/models/DbTable/PropertiesDB.php'; $ Property Rowset = $ table- & gt; FetchAll (); $ AllProperties = array (); Forex currency ($ assets $ rowset as line) {$ properties Rowset = $ row- & gt; FindManyToManyRowset ('Model_DbTable_Properties', 'Model_DbTable_UsersProperties'); $ AllProperties = array_merge ($ tempArray, $ propertiesRowset-> toArray ()); } Return all $ properties; }  

Thanks in advance

I designed and Related features in the coded Jend Framework

Your question is not answered; findManyToManyRowset () method only receives rows from the associated table, it does not merge them into the corresponding row object The reason is that In ZF, a row object can send itself back to the database in the save () , and if you add a field, they will not know what to do with them.

You must apply a custom line object to capture the user field and the collection of user properties - store user properties as a router object.

Then __get () and __set () to detect that you can correct the field during reading or writing the object properties How to map in the array That is, if someone tries to read or write a field that is not part of the user line, then that user's quality is returned to Rowet.

In addition to save () not only save the existing line, but call save () on the router of user properties.


Comments