Explorar o código

Merge pull request #258 from tolean/feature/treeClosure_with_custom_columns

Closure table should respect annotations
Gediminas Morkevicius %!s(int64=13) %!d(string=hai) anos
pai
achega
74c386b75e
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      lib/Gedmo/Tree/Strategy/ORM/Closure.php

+ 4 - 1
lib/Gedmo/Tree/Strategy/ORM/Closure.php

@@ -127,7 +127,10 @@ class Closure implements Strategy
         // create unique index on ancestor and descendant
         // create unique index on ancestor and descendant
         $indexName = substr(strtoupper("IDX_" . md5($closureMetadata->name)), 0, 20);
         $indexName = substr(strtoupper("IDX_" . md5($closureMetadata->name)), 0, 20);
         $closureMetadata->table['uniqueConstraints'][$indexName] = array(
         $closureMetadata->table['uniqueConstraints'][$indexName] = array(
-            'columns' => array('ancestor', 'descendant')
+            'columns' => array(
+                $this->getJoinColumnFieldName($em->getClassMetadata($config['closure'])->getAssociationMapping('ancestor')),
+                $this->getJoinColumnFieldName($em->getClassMetadata($config['closure'])->getAssociationMapping('descendant'))
+            )
         );
         );
         // this one may not be very usefull
         // this one may not be very usefull
         $indexName = substr(strtoupper("IDX_" . md5($meta->name . 'depth')), 0, 20);
         $indexName = substr(strtoupper("IDX_" . md5($meta->name . 'depth')), 0, 20);