Commits

Arkadiusz Dzięgiel  committed 62f71a0

changed tag table namespace
changed fk keys to cascade

  • Participants
  • Parent commits 679842a

Comments (0)

Files changed (1)

File Lib/Behavior/TaggableBehavior.php

                 'phpName'   => $tagTablePhpName,
                 'package'   => $table->getPackage(),
                 'schema'    => $table->getSchema(),
-                'namespace' => 'Propel\TaggableBehaviorBundle\Model',
+                'namespace' => '\\'.$table->getNamespace(),
             ));
+            
             // every behavior adding a table should re-execute database behaviors
             // see bug 2188 http://www.propelorm.org/changeset/2188
             foreach ($database->getBehaviors() as $behavior) {
                 'phpName'   => $this->replaceTokens($this->parameters['tagging_table_phpname']),
                 'package'   => $table->getPackage(),
                 'schema'    => $table->getSchema(),
-                'namespace' => $table->getNamespace(),
+                'namespace' => '\\'.$table->getNamespace(),
             ));
+            
             // every behavior adding a table should re-execute database behaviors
             // see bug 2188 http://www.propelorm.org/changeset/2188
             foreach ($database->getBehaviors() as $behavior) {
         $this->taggingTable->setIsCrossRef(true);
         
         $fkTag = new ForeignKey();
-        $fkTag->setForeignTableCommonName($this->tagTable->getName());
+        $fkTag->setForeignTableCommonName($this->tagTable->getCommonName());
         $fkTag->setForeignSchemaName($this->tagTable->getSchema());
         $fkTag->setOnDelete(ForeignKey::CASCADE);
-        $fkTag->setOnUpdate(ForeignKey::NONE);
+        $fkTag->setOnUpdate(ForeignKey::CASCADE);
         foreach ($pks as $column) {
-            $fkTag->addReference($tagFkColumn, $column->getName());
+            $fkTag->addReference($tagFkColumn->getName(), $column->getName());
         }
         $this->taggingTable->addForeignKey($fkTag);
 
         $fkObj = new ForeignKey();
-        $fkObj->setForeignTableCommonName($this->getTable()->getName());
+        $fkObj->setForeignTableCommonName($this->getTable()->getCommonName());
         $fkObj->setForeignSchemaName($this->getTable()->getSchema());
         $fkObj->setOnDelete(ForeignKey::CASCADE);
-        $fkObj->setOnUpdate(ForeignKey::NONE);
+        $fkObj->setOnUpdate(ForeignKey::CASCADE);
         foreach ($pks as $column) {
-            $fkObj->addReference($objFkColumn, $column->getName());
+            $fkObj->addReference($objFkColumn->getName(), $column->getName());
         }
         $this->taggingTable->addForeignKey($fkObj);
+        
     }
 
     /**