On May 31, 2010, at 5:21 AM, Steve Rayner wrote:
How does Zend Framework deal with the duplicated fieldname for id, created_date and modified_date?
echo $row->id; // which column will this get?
If you have duplicate column names, one will overwrite the other. There's no way for you to control which one takes priority.
Can i use some form of alias for these field names so that i can distinguish between them in the resulting recordset?
Unfortunately, findManyToManyRowset(), is hard-coded to fetch all columns from the matching table using the * wildcard. So you can't customize the columns without creating your own subclass of Zend_Db_Table_Row and rewriting that method, which is very complex.
Your only solution seems to be to bypass the Zend_Db_Table interface and run literal SQL queries, writing the joins and column aliases yourself, and executing the query against the Zend_Db_Adapter interface.
I particularly need the id of the record in the joining table, however the data returned by id seems to be that of the component table.
Regards,
Bill Karwin
没有评论:
发表评论