Skip to content

Commit

Permalink
Fixing KnpLabs#122
Browse files Browse the repository at this point in the history
Don't override existing uniqueConstraints
  • Loading branch information
pmontoya authored and kuczek committed Oct 25, 2014
1 parent a7704e8 commit 6cfd27a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/ORM/Translatable/TranslatableSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,9 @@ private function mapTranslation(ClassMetadata $classMetadata)

$name = $classMetadata->getTableName().'_unique_translation';
if (!$this->hasUniqueTranslationConstraint($classMetadata, $name)) {
$classMetadata->setPrimaryTable([
'uniqueConstraints' => [[
'name' => $name,
'columns' => ['translatable_id', 'locale' ]
]],
]);
$classMetadata->table['uniqueConstraints'][$name] = [
'columns' => ['translatable_id', 'locale' ]
];
}

if (!$classMetadata->hasField('locale')) {
Expand Down

0 comments on commit 6cfd27a

Please sign in to comment.