Skip to content

Commit ad3adca

Browse files
author
arp
committed
edited the way dupllicated foreignKey are detected when constructing the complete path of a magic join
1 parent 2de0175 commit ad3adca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Mouf/Database/MagicQuery.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,16 @@ private function magicJoinOnOneQuery(MagicJoinSelect $magicJoinSelect)
221221
// Let's remove the main table from the list of tables to be linked:
222222
unset($tables[$mainTable]);
223223

224-
$foreignKeysSet = new \SplObjectStorage();
224+
$foreignKeysSet = [];
225225
$completePath = [];
226226

227227
foreach ($tables as $table) {
228228
$path = $this->getSchemaAnalyzer()->getShortestPath($mainTable, $table);
229229
foreach ($path as $foreignKey) {
230230
// If the foreign key is not already in our complete path, let's add it.
231-
if (!$foreignKeysSet->contains($foreignKey)) {
231+
if (!isset($foreignKeysSet[$foreignKey->getName()])) {
232232
$completePath[] = $foreignKey;
233-
$foreignKeysSet->attach($foreignKey);
233+
$foreignKeysSet[$foreignKey->getName()] = true;
234234
}
235235
}
236236
}

0 commit comments

Comments
 (0)