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