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