Skip to content

Commit

Permalink
fix generate form for many-to-many relation, use isCrossRef informati…
Browse files Browse the repository at this point in the history
…on to prevent wrong generation
  • Loading branch information
jaugustin committed Oct 13, 2011
1 parent 7cb12ff commit 904b2fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/generator/sfPropelFormGenerator.class.php
Expand Up @@ -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())
Expand Down
4 changes: 4 additions & 0 deletions lib/generator/sfPropelGenerator.class.php
Expand Up @@ -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())
Expand Down

0 comments on commit 904b2fa

Please sign in to comment.