Skip to content

Commit b41ca3a

Browse files
authored
fixes #19
1 parent 549231d commit b41ca3a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

RelationTrait.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ public function loadAll($POST, $skippedRelations = [])
2929
/* @var $relObj ActiveRecord */
3030
$isHasMany = is_array($value) && is_array(current($value));
3131
$relName = ($isHasMany) ? lcfirst(Inflector::pluralize($key)) : lcfirst($key);
32+
33+
if (in_array($relName, $skippedRelations) || !array_key_exists($relName,$relData)){
34+
continue;
35+
}
36+
3237
$AQ = $this->getRelation($relName);
3338
$relModelClass = $AQ->modelClass;
3439
$relPKAttr = $relModelClass::primaryKey();
3540
$isManyMany = count($relPKAttr) > 1;
3641

37-
if (in_array($relName, $skippedRelations) || !array_key_exists($relName,$relData))
38-
continue;
39-
4042
if ($isManyMany) {
4143
$container = [];
4244
foreach ($value as $relPost) {

0 commit comments

Comments
 (0)