| @@ 822-839 (lines=18) @@ | ||
| 819 | /** |
|
| 820 | * {@inheritdoc} |
|
| 821 | */ |
|
| 822 | public function hasPrimaryKey($tableName, $columns, $constraint = null) |
|
| 823 | { |
|
| 824 | $primaryKey = $this->getPrimaryKey($tableName); |
|
| 825 | ||
| 826 | if (empty($primaryKey)) { |
|
| 827 | return false; |
|
| 828 | } |
|
| 829 | ||
| 830 | if ($constraint) { |
|
| 831 | return ($primaryKey['constraint'] === $constraint); |
|
| 832 | } else { |
|
| 833 | if (is_string($columns)) { |
|
| 834 | $columns = [$columns]; // str to array |
|
| 835 | } |
|
| 836 | $missingColumns = array_diff($columns, $primaryKey['columns']); |
|
| 837 | ||
| 838 | return empty($missingColumns); |
|
| 839 | } |
|
| 840 | } |
|
| 841 | ||
| 842 | /** |
|
| @@ 736-753 (lines=18) @@ | ||
| 733 | /** |
|
| 734 | * {@inheritdoc} |
|
| 735 | */ |
|
| 736 | public function hasPrimaryKey($tableName, $columns, $constraint = null) |
|
| 737 | { |
|
| 738 | $primaryKey = $this->getPrimaryKey($tableName); |
|
| 739 | ||
| 740 | if (empty($primaryKey)) { |
|
| 741 | return false; |
|
| 742 | } |
|
| 743 | ||
| 744 | if ($constraint) { |
|
| 745 | return ($primaryKey['constraint'] === $constraint); |
|
| 746 | } else { |
|
| 747 | if (is_string($columns)) { |
|
| 748 | $columns = [$columns]; // str to array |
|
| 749 | } |
|
| 750 | $missingColumns = array_diff($columns, $primaryKey['columns']); |
|
| 751 | ||
| 752 | return empty($missingColumns); |
|
| 753 | } |
|
| 754 | } |
|
| 755 | ||
| 756 | /** |
|
| @@ 682-699 (lines=18) @@ | ||
| 679 | /** |
|
| 680 | * {@inheritdoc} |
|
| 681 | */ |
|
| 682 | public function hasPrimaryKey($tableName, $columns, $constraint = null) |
|
| 683 | { |
|
| 684 | $primaryKey = $this->getPrimaryKey($tableName); |
|
| 685 | ||
| 686 | if (empty($primaryKey['constraint'])) { |
|
| 687 | return false; |
|
| 688 | } |
|
| 689 | ||
| 690 | if ($constraint) { |
|
| 691 | return ($primaryKey['constraint'] === $constraint); |
|
| 692 | } else { |
|
| 693 | if (is_string($columns)) { |
|
| 694 | $columns = [$columns]; // str to array |
|
| 695 | } |
|
| 696 | $missingColumns = array_diff($columns, $primaryKey['columns']); |
|
| 697 | ||
| 698 | return empty($missingColumns); |
|
| 699 | } |
|
| 700 | } |
|
| 701 | ||
| 702 | /** |
|