| @@ 606-620 (lines=15) @@ | ||
| 603 | * |
|
| 604 | * @return $this |
|
| 605 | */ |
|
| 606 | public function setCollation($collation) |
|
| 607 | { |
|
| 608 | $allowedTypes = [ |
|
| 609 | AdapterInterface::PHINX_TYPE_CHAR, |
|
| 610 | AdapterInterface::PHINX_TYPE_STRING, |
|
| 611 | AdapterInterface::PHINX_TYPE_TEXT, |
|
| 612 | ]; |
|
| 613 | if (!in_array($this->getType(), $allowedTypes)) { |
|
| 614 | throw new UnexpectedValueException('Collation may be set only for types: ' . implode(', ', $allowedTypes)); |
|
| 615 | } |
|
| 616 | ||
| 617 | $this->collation = $collation; |
|
| 618 | ||
| 619 | return $this; |
|
| 620 | } |
|
| 621 | ||
| 622 | /** |
|
| 623 | * Gets the column collation. |
|
| @@ 641-655 (lines=15) @@ | ||
| 638 | * |
|
| 639 | * @return $this |
|
| 640 | */ |
|
| 641 | public function setEncoding($encoding) |
|
| 642 | { |
|
| 643 | $allowedTypes = [ |
|
| 644 | AdapterInterface::PHINX_TYPE_CHAR, |
|
| 645 | AdapterInterface::PHINX_TYPE_STRING, |
|
| 646 | AdapterInterface::PHINX_TYPE_TEXT, |
|
| 647 | ]; |
|
| 648 | if (!in_array($this->getType(), $allowedTypes)) { |
|
| 649 | throw new UnexpectedValueException('Character set may be set only for types: ' . implode(', ', $allowedTypes)); |
|
| 650 | } |
|
| 651 | ||
| 652 | $this->encoding = $encoding; |
|
| 653 | ||
| 654 | return $this; |
|
| 655 | } |
|
| 656 | ||
| 657 | /** |
|
| 658 | * Gets the column character set. |
|