| @@ 508-522 (lines=15) @@ | ||
| 505 | * @throws \UnexpectedValueException If collation not allowed for type |
|
| 506 | * @return $this |
|
| 507 | */ |
|
| 508 | public function setCollation($collation) |
|
| 509 | { |
|
| 510 | $allowedTypes = [ |
|
| 511 | AdapterInterface::PHINX_TYPE_CHAR, |
|
| 512 | AdapterInterface::PHINX_TYPE_STRING, |
|
| 513 | AdapterInterface::PHINX_TYPE_TEXT, |
|
| 514 | ]; |
|
| 515 | if (!in_array($this->getType(), $allowedTypes)) { |
|
| 516 | throw new \UnexpectedValueException('Collation may be set only for types: ' . implode(', ', $allowedTypes)); |
|
| 517 | } |
|
| 518 | ||
| 519 | $this->collation = $collation; |
|
| 520 | ||
| 521 | return $this; |
|
| 522 | } |
|
| 523 | ||
| 524 | /** |
|
| 525 | * Gets the column collation. |
|
| @@ 542-556 (lines=15) @@ | ||
| 539 | * @throws \UnexpectedValueException If character set not allowed for type |
|
| 540 | * @return $this |
|
| 541 | */ |
|
| 542 | public function setEncoding($encoding) |
|
| 543 | { |
|
| 544 | $allowedTypes = [ |
|
| 545 | AdapterInterface::PHINX_TYPE_CHAR, |
|
| 546 | AdapterInterface::PHINX_TYPE_STRING, |
|
| 547 | AdapterInterface::PHINX_TYPE_TEXT, |
|
| 548 | ]; |
|
| 549 | if (!in_array($this->getType(), $allowedTypes)) { |
|
| 550 | throw new \UnexpectedValueException('Character set may be set only for types: ' . implode(', ', $allowedTypes)); |
|
| 551 | } |
|
| 552 | ||
| 553 | $this->encoding = $encoding; |
|
| 554 | ||
| 555 | return $this; |
|
| 556 | } |
|
| 557 | ||
| 558 | /** |
|
| 559 | * Gets the column character set. |
|