Skip to content

Commit b6af2be

Browse files
author
Pooya Parsa
committed
formatSyncList legacy support
1 parent 76281c1 commit b6af2be

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Jenssegers/Mongodb/Relations/BelongsToMany.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,24 @@ public function getForeignKey()
286286
{
287287
return $this->foreignKey;
288288
}
289+
290+
/**
291+
* Format the sync list so that it is keyed by ID. (Legacy Support)
292+
* The original function has been renamed to formatRecordsList since Laravel 5.3
293+
*
294+
* @deprecated
295+
* @param array $records
296+
* @return array
297+
*/
298+
protected function formatSyncList(array $records)
299+
{
300+
$results = [];
301+
foreach ($records as $id => $attributes) {
302+
if (! is_array($attributes)) {
303+
list($id, $attributes) = [$attributes, []];
304+
}
305+
$results[$id] = $attributes;
306+
}
307+
return $results;
308+
}
289309
}

0 commit comments

Comments
 (0)