Browse Source

Merge pull request #258 from tolean/feature/treeClosure_with_custom_columns

Closure table should respect annotations
Gediminas Morkevicius 13 năm trước cách đây
mục cha
commit
74c386b75e
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  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
         $indexName = substr(strtoupper("IDX_" . md5($closureMetadata->name)), 0, 20);
         $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
         $indexName = substr(strtoupper("IDX_" . md5($meta->name . 'depth')), 0, 20);