| @@ 840-857 (lines=18) @@ | ||
| 837 | /** |
|
| 838 | * @inheritDoc |
|
| 839 | */ |
|
| 840 | public function hasPrimaryKey($tableName, $columns, $constraint = null) |
|
| 841 | { |
|
| 842 | $primaryKey = $this->getPrimaryKey($tableName); |
|
| 843 | ||
| 844 | if (empty($primaryKey)) { |
|
| 845 | return false; |
|
| 846 | } |
|
| 847 | ||
| 848 | if ($constraint) { |
|
| 849 | return ($primaryKey['constraint'] === $constraint); |
|
| 850 | } else { |
|
| 851 | if (is_string($columns)) { |
|
| 852 | $columns = [$columns]; // str to array |
|
| 853 | } |
|
| 854 | $missingColumns = array_diff($columns, $primaryKey['columns']); |
|
| 855 | ||
| 856 | return empty($missingColumns); |
|
| 857 | } |
|
| 858 | } |
|
| 859 | ||
| 860 | /** |
|
| @@ 745-762 (lines=18) @@ | ||
| 742 | /** |
|
| 743 | * @inheritDoc |
|
| 744 | */ |
|
| 745 | public function hasPrimaryKey($tableName, $columns, $constraint = null) |
|
| 746 | { |
|
| 747 | $primaryKey = $this->getPrimaryKey($tableName); |
|
| 748 | ||
| 749 | if (empty($primaryKey)) { |
|
| 750 | return false; |
|
| 751 | } |
|
| 752 | ||
| 753 | if ($constraint) { |
|
| 754 | return ($primaryKey['constraint'] === $constraint); |
|
| 755 | } else { |
|
| 756 | if (is_string($columns)) { |
|
| 757 | $columns = [$columns]; // str to array |
|
| 758 | } |
|
| 759 | $missingColumns = array_diff($columns, $primaryKey['columns']); |
|
| 760 | ||
| 761 | return empty($missingColumns); |
|
| 762 | } |
|
| 763 | } |
|
| 764 | ||
| 765 | /** |
|
| @@ 690-707 (lines=18) @@ | ||
| 687 | /** |
|
| 688 | * @inheritDoc |
|
| 689 | */ |
|
| 690 | public function hasPrimaryKey($tableName, $columns, $constraint = null) |
|
| 691 | { |
|
| 692 | $primaryKey = $this->getPrimaryKey($tableName); |
|
| 693 | ||
| 694 | if (empty($primaryKey['constraint'])) { |
|
| 695 | return false; |
|
| 696 | } |
|
| 697 | ||
| 698 | if ($constraint) { |
|
| 699 | return ($primaryKey['constraint'] === $constraint); |
|
| 700 | } else { |
|
| 701 | if (is_string($columns)) { |
|
| 702 | $columns = [$columns]; // str to array |
|
| 703 | } |
|
| 704 | $missingColumns = array_diff($columns, $primaryKey['columns']); |
|
| 705 | ||
| 706 | return empty($missingColumns); |
|
| 707 | } |
|
| 708 | } |
|
| 709 | ||
| 710 | /** |
|