| @@ 583-600 (lines=18) @@ | ||
| 580 | /** |
|
| 581 | * {@inheritdoc} |
|
| 582 | */ |
|
| 583 | public function hasIndex($tableName, $columns) |
|
| 584 | { |
|
| 585 | if (is_string($columns)) { |
|
| 586 | $columns = [$columns]; // str to array |
|
| 587 | } |
|
| 588 | ||
| 589 | $columns = array_map('strtolower', $columns); |
|
| 590 | $indexes = $this->getIndexes($tableName); |
|
| 591 | ||
| 592 | foreach ($indexes as $index) { |
|
| 593 | $a = array_diff($columns, $index['columns']); |
|
| 594 | if (empty($a)) { |
|
| 595 | return true; |
|
| 596 | } |
|
| 597 | } |
|
| 598 | ||
| 599 | return false; |
|
| 600 | } |
|
| 601 | ||
| 602 | /** |
|
| 603 | * {@inheritdoc} |
|
| @@ 656-674 (lines=19) @@ | ||
| 653 | /** |
|
| 654 | * {@inheritdoc} |
|
| 655 | */ |
|
| 656 | public function hasIndex($tableName, $columns) |
|
| 657 | { |
|
| 658 | if (is_string($columns)) { |
|
| 659 | $columns = [$columns]; // str to array |
|
| 660 | } |
|
| 661 | ||
| 662 | $columns = array_map('strtolower', $columns); |
|
| 663 | $indexes = $this->getIndexes($tableName); |
|
| 664 | ||
| 665 | foreach ($indexes as $index) { |
|
| 666 | $a = array_diff($columns, $index['columns']); |
|
| 667 | ||
| 668 | if (empty($a)) { |
|
| 669 | return true; |
|
| 670 | } |
|
| 671 | } |
|
| 672 | ||
| 673 | return false; |
|
| 674 | } |
|
| 675 | ||
| 676 | /** |
|
| 677 | * {@inheritdoc} |
|