Skip to content

Commit

Permalink
Extension: Check if data type already exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek authored Jan 15, 2020
1 parent ede8e1d commit 1fb48e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/DatabaseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ private function getTypeDefinition(): string
$return = '';

foreach ($this->getConfig()['types'] ?? [] as $name => $className) {
$return .= "\t" . '\Doctrine\DBAL\Types\Type::addType('
$return .= "\t" . 'if (\Doctrine\DBAL\Types\Type::hasType(' . Helpers::dump($name) . ') === false) { '
. '\Doctrine\DBAL\Types\Type::addType('
. Helpers::dump($name) . ',' . Helpers::dump($className)
. ');' . "\n";
. '); }' . "\n";
}

return $return;
Expand Down

0 comments on commit 1fb48e2

Please sign in to comment.