@@ 471-498 (lines=28) @@ | ||
468 | ||
469 | $fkMethodName = null; |
|
470 | $rkMethodName = null; |
|
471 | if ($condition) { |
|
472 | if (array_key_exists(get_class($foo), static::$methodPrimary)) { |
|
473 | $line = static::$methodPrimary[get_class($foo)]; |
|
474 | $fkMethodName = $line['fk']; |
|
475 | $rkMethodName = $line['rk']; |
|
476 | } else { |
|
477 | $methodList = get_class_methods(get_class($foo)); |
|
478 | $fkMethodName = 'getQualifiedForeignPivotKeyName'; |
|
479 | foreach ($fkList as $option) { |
|
480 | if (in_array($option, $methodList)) { |
|
481 | $fkMethodName = $option; |
|
482 | break; |
|
483 | } |
|
484 | } |
|
485 | assert(in_array($fkMethodName, $methodList), 'Selected method, '.$fkMethodName.', not in method list'); |
|
486 | $rkMethodName = 'getQualifiedRelatedPivotKeyName'; |
|
487 | foreach ($rkList as $option) { |
|
488 | if (in_array($option, $methodList)) { |
|
489 | $rkMethodName = $option; |
|
490 | break; |
|
491 | } |
|
492 | } |
|
493 | assert(in_array($rkMethodName, $methodList), 'Selected method, '.$rkMethodName.', not in method list'); |
|
494 | $line = ['fk' => $fkMethodName, 'rk' => $rkMethodName]; |
|
495 | static::$methodPrimary[get_class($foo)] = $line; |
|
496 | } |
|
497 | } |
|
498 | return [$fkMethodName, $rkMethodName]; |
|
499 | } |
|
500 | ||
501 | private function polyglotKeyMethodBackupNames($foo, $condition = false) |
|
@@ 508-534 (lines=27) @@ | ||
505 | ||
506 | $fkMethodName = null; |
|
507 | $rkMethodName = null; |
|
508 | if ($condition) { |
|
509 | if (array_key_exists(get_class($foo), static::$methodAlternate)) { |
|
510 | $line = static::$methodAlternate[get_class($foo)]; |
|
511 | $fkMethodName = $line['fk']; |
|
512 | $rkMethodName = $line['rk']; |
|
513 | } else { |
|
514 | $methodList = get_class_methods(get_class($foo)); |
|
515 | $fkMethodName = 'getForeignKeyName'; |
|
516 | foreach ($fkList as $option) { |
|
517 | if (in_array($option, $methodList)) { |
|
518 | $fkMethodName = $option; |
|
519 | break; |
|
520 | } |
|
521 | } |
|
522 | assert(in_array($fkMethodName, $methodList), 'Selected method, '.$fkMethodName.', not in method list'); |
|
523 | $rkMethodName = 'getQualifiedParentKeyName'; |
|
524 | foreach ($rkList as $option) { |
|
525 | if (in_array($option, $methodList)) { |
|
526 | $rkMethodName = $option; |
|
527 | break; |
|
528 | } |
|
529 | } |
|
530 | assert(in_array($rkMethodName, $methodList), 'Selected method, '.$rkMethodName.', not in method list'); |
|
531 | $line = ['fk' => $fkMethodName, 'rk' => $rkMethodName]; |
|
532 | static::$methodAlternate[get_class($foo)] = $line; |
|
533 | } |
|
534 | } |
|
535 | return [$fkMethodName, $rkMethodName]; |
|
536 | } |
|
537 |