Permalink
Browse files

fix generate form for many-to-many relation, use isCrossRef informati…

…on to prevent wrong generation
  • Loading branch information...
1 parent 7cb12ff commit 904b2fa016f9b03d3def51e31a3b62453abbab5c @jaugustin committed Oct 13, 2011
Showing with 8 additions and 0 deletions.
  1. +4 −0 lib/generator/sfPropelFormGenerator.class.php
  2. +4 −0 lib/generator/sfPropelGenerator.class.php
@@ -125,6 +125,10 @@ public function getManyToManyTables()
// go through all tables to find m2m relationships
foreach ($this->dbMap->getTables() as $tableName => $table)
{
+ if (!$table->isCrossRef()) {
+ continue;
+ }
+
foreach ($table->getColumns() as $column)
{
if ($column->isForeignKey() && $column->isPrimaryKey() && $this->table->getClassname() == $this->getForeignTable($column)->getClassname())
@@ -73,6 +73,10 @@ public function getManyToManyTables()
// load this table's relations and related tables
$table->getRelations();
+ if (!$table->isCrossRef()) {
+ continue;
+ }
+
foreach ($table->getColumns() as $column)
{
if ($column->isForeignKey() && $column->isPrimaryKey() && $this->getTableMap()->getClassname() == $this->dbMap->getTable($column->getRelatedTableName())->getClassname())

0 comments on commit 904b2fa

Please sign in to comment.