Skip to content
Browse files

Database: fixed comparing result-set keys [Closes #936]

Php tends to somehow shuffle array keys in case of bigger result-set
  • Loading branch information...
1 parent 6ce769c commit 67f5e1c75afa000ac36d22ca71a7352c4e6f60ca @hrach hrach committed Mar 18, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 Nette/Database/Table/Selection.php
View
8 Nette/Database/Table/Selection.php
@@ -768,8 +768,12 @@ public function getReferencedTable($table, $column, $checkReferenced = FALSE)
$keys[$key] = TRUE;
}
- if ($referenced !== NULL && array_keys($keys) === array_keys($referenced->rows)) {
- return $referenced;
+ if ($referenced !== NULL) {
+ $a = array_keys($keys);
+ $b = array_keys($referenced->rows);
+ if (!array_diff($a, $b) && !array_diff($b, $a)) {
+ return $referenced;
+ }
}
if ($keys) {

0 comments on commit 67f5e1c

Please sign in to comment.
Something went wrong with that request. Please try again.