Skip to content
This repository was archived by the owner on May 12, 2022. It is now read-only.

Commit 12825b1

Browse files
author
Nik Barham
committed
Minor cleanup and fixing some Warnings
1 parent c509f40 commit 12825b1

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/Automatorm/Orm/Model.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -387,24 +387,10 @@ final public function dataClearCache()
387387
}
388388

389389
// Clean out cached external data
390-
foreach ($modelschema['one-to-one'] as $column => $value)
390+
$foreignkeys = (array) $modelschema['one-to-one'] + (array) $modelschema['one-to-many'] + (array) $modelschema['many-to-many'] + (array) $modelschema['many-to-one'];
391+
foreach ($foreignkeys as $column => $value)
391392
{
392-
if ($column != 'id') unset($this->{$column});
393-
}
394-
395-
foreach ($modelschema['one-to-many'] as $column => $value)
396-
{
397-
if ($column != 'id') unset($this->{$column});
398-
}
399-
400-
foreach ($modelschema['many-to-many'] as $column => $value)
401-
{
402-
if ($column != 'id') unset($this->{$column});
403-
}
404-
405-
foreach ($modelschema['many-to-one'] as $column => $value)
406-
{
407-
if ($column != 'id') unset($this->{$column});
393+
if ($column && $column != 'id') unset($this->{$column});
408394
}
409395
}
410396

0 commit comments

Comments
 (0)