@@ 276-279 (lines=4) @@ | ||
273 | // Check if there is relationship defined in many_many (includes belongs_many_many) |
|
274 | $manyField = null; |
|
275 | $oneField = null; |
|
276 | if ($relationObj->many_many()) { |
|
277 | $manyField = array_search($class, $relationObj->many_many()); |
|
278 | if($manyField && strlen($relationName) > 0) $manyField = $relationName; |
|
279 | } |
|
280 | if(empty($manyField) && $relationObj->has_many()) { |
|
281 | $manyField = array_search($class, $relationObj->has_many()); |
|
282 | if($manyField && strlen($relationName) > 0) $manyField = $relationName; |
|
@@ 280-283 (lines=4) @@ | ||
277 | $manyField = array_search($class, $relationObj->many_many()); |
|
278 | if($manyField && strlen($relationName) > 0) $manyField = $relationName; |
|
279 | } |
|
280 | if(empty($manyField) && $relationObj->has_many()) { |
|
281 | $manyField = array_search($class, $relationObj->has_many()); |
|
282 | if($manyField && strlen($relationName) > 0) $manyField = $relationName; |
|
283 | } |
|
284 | if(empty($manyField) && $relationObj->has_one()) { |
|
285 | $oneField = array_search($class, $relationObj->has_one()); |
|
286 | if($oneField && strlen($relationName) > 0) $oneField = $relationName; |
|
@@ 284-287 (lines=4) @@ | ||
281 | $manyField = array_search($class, $relationObj->has_many()); |
|
282 | if($manyField && strlen($relationName) > 0) $manyField = $relationName; |
|
283 | } |
|
284 | if(empty($manyField) && $relationObj->has_one()) { |
|
285 | $oneField = array_search($class, $relationObj->has_one()); |
|
286 | if($oneField && strlen($relationName) > 0) $oneField = $relationName; |
|
287 | } |
|
288 | if(empty($manyField) && empty($oneField)) { |
|
289 | throw new \Exception("'$relationClass' has no relationship (has_one, has_many and many_many) with '$class'!"); |
|
290 | } |