Skip to content

Commit

Permalink
Remove ColumnFactory::fromDefinition() method
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Sep 9, 2024
1 parent 1ca13d2 commit 2bf862f
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/Column/ColumnFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Yiisoft\Db\Constant\ColumnType;
use Yiisoft\Db\Schema\Column\AbstractColumnFactory;
use Yiisoft\Db\Schema\Column\ColumnSchemaInterface;

final class ColumnFactory extends AbstractColumnFactory
{
Expand Down Expand Up @@ -49,20 +48,6 @@ final class ColumnFactory extends AbstractColumnFactory
'json' => ColumnType::JSON,
];

public function fromDefinition(string $definition, array $info = []): ColumnSchemaInterface
{
if (str_starts_with($definition, 'enum(')) {
preg_match('/^enum\(([^)]+)\)\s*/', $definition, $matches);
preg_match_all("/'([^']*)'/", $matches[1], $values);

$info['enum_values'] = $values[1];

return $this->fromDbType('enum', $info);
}

return parent::fromDefinition($definition, $info);
}

protected function getType(string $dbType, array $info = []): string
{
$type = self::TYPE_MAP[$dbType] ?? ColumnType::STRING;
Expand Down

0 comments on commit 2bf862f

Please sign in to comment.