Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #90 from frenchcomp/patch-2

Update library/Centurion/Db/Table/Row/Abstract.php
  • Loading branch information...
commit fb546c6945c13944cd25d722b77f7446bfb7b938 2 parents 1370fb5 + 4c38424
@lchenay lchenay authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 library/Centurion/Db/Table/Row/Abstract.php
View
16 library/Centurion/Db/Table/Row/Abstract.php
@@ -238,10 +238,24 @@ public function __get($columnName)
$data['refforeign'] = substr($data['columns']['foreign'], 0, -3);
$data['reflocal'] = substr($data['columns']['local'], 0, -3);
}
+
+ //Support of ordered many to many to avoid regression
+ $intersectionTable = $data['intersectionTable'];
+ if (is_string($intersectionTable)) {
+ //this operation is also performed in the next call to findManyToManyRowset()
+ $intersectionTable = $this->_getTableFromString($intersectionTable);
+ }
+
+ if (in_array('order', $intersectionTable->info('cols'))) {
+ // Use adapter from intersection table to ensure correct query construction
+ $interName = $intersectionTable->info(Centurion_Db_Table::NAME);
+ //findManyToManyRowset() not perform this because we send a select object to the method
+ $select->order($interName.'.order asc');
+ }
$this->_children[$columnName]
= $this->findManyToManyRowset($data['refTableClass'],
- $data['intersectionTable'],
+ $intersectionTable,
$data['reflocal'],
$data['refforeign'],
$select, $refForeignCond);
Please sign in to comment.
Something went wrong with that request. Please try again.