Development

Changeset 7055

You must first sign up to be able to contribute.

Changeset 7055

Show
Ignore:
Timestamp:
01/14/08 20:50:27 (8 months ago)
Author:
fabien
Message:

fixed many to many relationship in Propel generated forms

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/plugins/sfPropelPlugin/data/generator/sfPropelForm/default/template/sfPropelFormGeneratedTemplate.php

    r6967 r7055  
    6565    if (!isset($this-><?php echo $name ?>Choices)) 
    6666    { 
    67       $this-><?php echo $name ?>Choices = array(<?php !$info[2] and print "'' => ''" ?>); 
     67      $this-><?php echo $name ?>Choices = array(<?php !$info[2] && !$info[3] and print "'' => ''" ?>); 
    6868      foreach (<?php echo $info[0] ?>Peer::doSelect(new Criteria(), $this->getConnection()) as $object) 
    6969      { 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php

    r6966 r7055  
    137137   * This method does not returns foreign keys that are also primary keys. 
    138138   * 
    139    * @return array An array composed of: an array of foreign key PHP names, A Boolean to indicate whether the column is required or not 
     139   * @return array An array composed of:  
     140   *                 * The foreign table PHP name 
     141   *                 * The foreign key PHP name 
     142   *                 * A Boolean to indicate whether the column is required or not 
     143   *                 * A Boolean to indicate whether the column is a many to many relationship or not 
    140144   */ 
    141145  public function getForeignKeyNames() 
     
    146150      if (!$column->isPrimaryKey() && $column->isForeignKey()) 
    147151      { 
    148         $names[] = array($this->getForeignTable($column)->getPhpName(), $column->getPhpName(), $column->isNotNull()); 
     152        $names[] = array($this->getForeignTable($column)->getPhpName(), $column->getPhpName(), $column->isNotNull(), false); 
    149153      } 
    150154    } 
     
    152156    foreach ($this->getManyToManyTables() as $tables) 
    153157    { 
    154       $names[] = array($tables['relatedTable']->getPhpName(), $tables['middleTable']->getPhpName(), false); 
     158      $names[] = array($tables['relatedTable']->getPhpName(), $tables['middleTable']->getPhpName(), false, true); 
    155159    } 
    156160