Changeset 6965
- Timestamp:
- 01/06/08 06:15:33 (11 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/plugins/sfPropelPlugin/data/generator/sfPropelForm/default/template/sfPropelFormGeneratedTemplate.php
r6944 r6965 18 18 <?php endforeach; ?> 19 19 <?php foreach ($this->getManyToManyTables() as $tables): ?> 20 '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfWidgetFormSelectMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables[' relatedTable']->getPhpName() ?>Choices')))),20 '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfWidgetFormSelectMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables['middleTable']->getPhpName() ?>Choices')))), 21 21 <?php endforeach; ?> 22 22 )); … … 27 27 <?php endforeach; ?> 28 28 <?php foreach ($this->getManyToManyTables() as $tables): ?> 29 '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfValidatorChoiceMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables[' relatedTable']->getPhpName() ?>IdentifierChoices')))),29 '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfValidatorChoiceMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables['middleTable']->getPhpName() ?>IdentifierChoices')))), 30 30 <?php endforeach; ?> 31 31 )); … … 55 55 <?php endif; ?> 56 56 57 <?php foreach ($this->getForeignKeyNames() as $info): $name = $info[ 0] ?>57 <?php foreach ($this->getForeignKeyNames() as $info): $name = $info[1] ?> 58 58 public function get<?php echo $name ?>IdentifierChoices() 59 59 { … … 65 65 if (!isset($this-><?php echo $name ?>Choices)) 66 66 { 67 $this-><?php echo $name ?>Choices = array(<?php !$info[ 1] and print "'' => ''" ?>);68 foreach (<?php echo $ name?>Peer::doSelect(new Criteria(), $this->getConnection()) as $object)67 $this-><?php echo $name ?>Choices = array(<?php !$info[2] and print "'' => ''" ?>); 68 foreach (<?php echo $info[0] ?>Peer::doSelect(new Criteria(), $this->getConnection()) as $object) 69 69 { 70 70 $this-><?php echo $name ?>Choices[$object->get<?php echo $this->getPrimaryKey()->getPhpName() ?>()] = $object->__toString(); branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php
r6873 r6965 146 146 if (!$column->isPrimaryKey() && $column->isForeignKey()) 147 147 { 148 $names[] = array($this->getForeignTable($column)->getPhpName(), $column-> isNotNull());148 $names[] = array($this->getForeignTable($column)->getPhpName(), $column->getPhpName(), $column->isNotNull()); 149 149 } 150 150 } … … 152 152 foreach ($this->getManyToManyTables() as $tables) 153 153 { 154 $names[] = array($tables['relatedTable']->getPhpName(), false);154 $names[] = array($tables['relatedTable']->getPhpName(), $tables['middleTable']->getPhpName(), false); 155 155 } 156 156 … … 241 241 if (!$column->isPrimaryKey() && $column->isForeignKey()) 242 242 { 243 $options[] = sprintf('\'choices\' => new sfCallable(array($this, \'get%sChoices\'))', $ this->getForeignTable($column)->getPhpName());243 $options[] = sprintf('\'choices\' => new sfCallable(array($this, \'get%sChoices\'))', $column->getPhpName()); 244 244 } 245 245