Skip to content

Commit

Permalink
Performance enhancement for stitching related data to parent record
Browse files Browse the repository at this point in the history
  • Loading branch information
rotimi committed Feb 27, 2023
1 parent 65b7539 commit 02513fb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/LeanOrm/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,13 @@ protected function loadHasOne(
FROM {$foreign_table_name}
WHERE {$foreign_table_name}.{$fkey_col_in_foreign_table} = {$parent_data->$fkey_col_in_my_table}
*/
//re-key related data on the foreign key column values
$related_data =
array_combine(
array_column($related_data, $fkey_col_in_foreign_table),
$related_data
);

// //re-key related data on the foreign key column values
// $related_data =
// array_combine(
// array_column($related_data, $fkey_col_in_foreign_table),
// $related_data
// );

if (
$parent_data instanceof \GDAO\Model\CollectionInterface
Expand Down

0 comments on commit 02513fb

Please sign in to comment.