Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
N/A
-
Resolution: Duplicate
-
Affects Version/s: None
-
Fix Version/s: 1.10.2
-
Component/s: Zend_Db_Table
-
Labels:None
Description
Hello,
I've found that the method findManyToManyRowset() from the Zend_Db_Table_Row_Abstract returns all columns both from the matching and intersection tables in the resulting rowset. Is that safe? I mean what happens if the matching and intersection table have a same column name with different values? Would the results be valid? However the $select sets integrityCheck off and consequently the result rowset's readOnly flag off too.
I believe that the result rowset should not contain any values from the intersection table or optionaly some column collision checking should be done. At least, if the resulting rowset contains any values from the intersection table, it should be marked readOnly for sake.
Best regards,
Ludek Stepan
Hi,
I believe this is linked to http://framework.zend.com/issues/browse/ZF-3709
Inside Zend_Db_Table_Row_Abstract line 1053 onwards we have
$select->from(array('i' => $interName), Zend_Db_Select::SQL_WILDCARD, $interSchema) ->joinInner(array('m' => $matchName), $joinCond, Zend_Db_Select::SQL_WILDCARD, $matchSchema) ->setIntegrityCheck(false);I believe the from column declaration is causing the issue and should be
$select->from(array('i' => $interName), array(), $interSchema) ->joinInner(array('m' => $matchName), $joinCond, Zend_Db_Select::SQL_WILDCARD, $matchSchema) ->setIntegrityCheck(false);to hide all the columns of the intersection table. This would then matchup with the documentation in http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.fetching.many-to-many
$select->from(array('i' => $interName), Zend_Db_Select::SQL_WILDCARD, $interSchema) ->joinInner(array('m' => $matchName), $joinCond, Zend_Db_Select::SQL_WILDCARD, $matchSchema) ->setIntegrityCheck(false);$select->from(array('i' => $interName), array(), $interSchema) ->joinInner(array('m' => $matchName), $joinCond, Zend_Db_Select::SQL_WILDCARD, $matchSchema) ->setIntegrityCheck(false);