| @@ 553-567 (lines=15) @@ | ||
| 550 | * @throws \UnexpectedValueException If collation not allowed for type |
|
| 551 | * @return $this |
|
| 552 | */ |
|
| 553 | public function setCollation($collation) |
|
| 554 | { |
|
| 555 | $allowedTypes = [ |
|
| 556 | AdapterInterface::PHINX_TYPE_CHAR, |
|
| 557 | AdapterInterface::PHINX_TYPE_STRING, |
|
| 558 | AdapterInterface::PHINX_TYPE_TEXT, |
|
| 559 | ]; |
|
| 560 | if (!in_array($this->getType(), $allowedTypes)) { |
|
| 561 | throw new \UnexpectedValueException('Collation may be set only for types: ' . implode(', ', $allowedTypes)); |
|
| 562 | } |
|
| 563 | ||
| 564 | $this->collation = $collation; |
|
| 565 | ||
| 566 | return $this; |
|
| 567 | } |
|
| 568 | ||
| 569 | /** |
|
| 570 | * Gets the column collation. |
|
| @@ 587-601 (lines=15) @@ | ||
| 584 | * @throws \UnexpectedValueException If character set not allowed for type |
|
| 585 | * @return $this |
|
| 586 | */ |
|
| 587 | public function setEncoding($encoding) |
|
| 588 | { |
|
| 589 | $allowedTypes = [ |
|
| 590 | AdapterInterface::PHINX_TYPE_CHAR, |
|
| 591 | AdapterInterface::PHINX_TYPE_STRING, |
|
| 592 | AdapterInterface::PHINX_TYPE_TEXT, |
|
| 593 | ]; |
|
| 594 | if (!in_array($this->getType(), $allowedTypes)) { |
|
| 595 | throw new \UnexpectedValueException('Character set may be set only for types: ' . implode(', ', $allowedTypes)); |
|
| 596 | } |
|
| 597 | ||
| 598 | $this->encoding = $encoding; |
|
| 599 | ||
| 600 | return $this; |
|
| 601 | } |
|
| 602 | ||
| 603 | /** |
|
| 604 | * Gets the column character set. |
|