| @@ 409-436 (lines=28) @@ | ||
| 406 | ||
| 407 | $fkMethodName = null; |
|
| 408 | $rkMethodName = null; |
|
| 409 | if ($condition) { |
|
| 410 | if (array_key_exists(get_class($foo), static::$methodPrimary)) { |
|
| 411 | $line = static::$methodPrimary[get_class($foo)]; |
|
| 412 | $fkMethodName = $line['fk']; |
|
| 413 | $rkMethodName = $line['rk']; |
|
| 414 | } else { |
|
| 415 | $methodList = get_class_methods(get_class($foo)); |
|
| 416 | $fkMethodName = 'getQualifiedForeignPivotKeyName'; |
|
| 417 | foreach ($fkList as $option) { |
|
| 418 | if (in_array($option, $methodList)) { |
|
| 419 | $fkMethodName = $option; |
|
| 420 | break; |
|
| 421 | } |
|
| 422 | } |
|
| 423 | assert(in_array($fkMethodName, $methodList), "Selected method, ".$fkMethodName.", not in method list"); |
|
| 424 | $rkMethodName = 'getQualifiedRelatedPivotKeyName'; |
|
| 425 | foreach ($rkList as $option) { |
|
| 426 | if (in_array($option, $methodList)) { |
|
| 427 | $rkMethodName = $option; |
|
| 428 | break; |
|
| 429 | } |
|
| 430 | } |
|
| 431 | assert(in_array($rkMethodName, $methodList), "Selected method, ".$rkMethodName.", not in method list"); |
|
| 432 | $line = ['fk' => $fkMethodName, 'rk' => $rkMethodName]; |
|
| 433 | static::$methodPrimary[get_class($foo)] = $line; |
|
| 434 | } |
|
| 435 | ||
| 436 | } |
|
| 437 | return array($fkMethodName, $rkMethodName); |
|
| 438 | } |
|
| 439 | ||
| @@ 447-473 (lines=27) @@ | ||
| 444 | ||
| 445 | $fkMethodName = null; |
|
| 446 | $rkMethodName = null; |
|
| 447 | if ($condition) { |
|
| 448 | if (array_key_exists(get_class($foo), static::$methodAlternate)) { |
|
| 449 | $line = static::$methodAlternate[get_class($foo)]; |
|
| 450 | $fkMethodName = $line['fk']; |
|
| 451 | $rkMethodName = $line['rk']; |
|
| 452 | } else { |
|
| 453 | $methodList = get_class_methods(get_class($foo)); |
|
| 454 | $fkMethodName = 'getForeignKeyName'; |
|
| 455 | foreach ($fkList as $option) { |
|
| 456 | if (in_array($option, $methodList)) { |
|
| 457 | $fkMethodName = $option; |
|
| 458 | break; |
|
| 459 | } |
|
| 460 | } |
|
| 461 | assert(in_array($fkMethodName, $methodList), "Selected method, ".$fkMethodName.", not in method list"); |
|
| 462 | $rkMethodName = 'getQualifiedParentKeyName'; |
|
| 463 | foreach ($rkList as $option) { |
|
| 464 | if (in_array($option, $methodList)) { |
|
| 465 | $rkMethodName = $option; |
|
| 466 | break; |
|
| 467 | } |
|
| 468 | } |
|
| 469 | assert(in_array($rkMethodName, $methodList), "Selected method, ".$rkMethodName.", not in method list"); |
|
| 470 | $line = ['fk' => $fkMethodName, 'rk' => $rkMethodName]; |
|
| 471 | static::$methodAlternate[get_class($foo)] = $line; |
|
| 472 | } |
|
| 473 | } |
|
| 474 | return array($fkMethodName, $rkMethodName); |
|
| 475 | } |
|
| 476 | ||