Changeset 8508
- Timestamp:
- 04/17/08 19:39:15 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/plugins/sfPropelPlugin/data/generator/sfPropelForm/default/template/sfPropelFormGeneratedTemplate.php
r8387 r8508 5 5 * 6 6 * @package form 7 * @subpackage <?php echo $this-> table->getName() ?>7 * @subpackage <?php echo $this->underscore($this->table->getPhpName()) ?> 8 8 9 9 * @version SVN: $Id$ … … 18 18 <?php endforeach; ?> 19 19 <?php foreach ($this->getManyToManyTables() as $tables): ?> 20 '<?php echo $t ables['middleTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['middleTable']->getName().'_list')) ?> => new sfWidgetFormPropelSelectMany(array('model' => '<?php echo $tables['relatedTable']->getPhpName() ?>')),20 '<?php echo $this->underscore($tables['middleTable']->getPhpName()) ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($this->underscore($tables['middleTable']->getPhpName()).'_list')) ?> => new sfWidgetFormPropelSelectMany(array('model' => '<?php echo $tables['relatedTable']->getPhpName() ?>')), 21 21 <?php endforeach; ?> 22 22 )); … … 27 27 <?php endforeach; ?> 28 28 <?php foreach ($this->getManyToManyTables() as $tables): ?> 29 '<?php echo $t ables['middleTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['middleTable']->getName().'_list')) ?> => new sfValidatorPropelChoiceMany(array('model' => '<?php echo $tables['relatedTable']->getPhpName() ?>', 'required' => false)),29 '<?php echo $this->underscore($tables['middleTable']->getPhpName()) ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($this->underscore($tables['middleTable']->getPhpName()).'_list')) ?> => new sfValidatorPropelChoiceMany(array('model' => '<?php echo $tables['relatedTable']->getPhpName() ?>', 'required' => false)), 30 30 <?php endforeach; ?> 31 31 )); 32 32 33 $this->widgetSchema->setNameFormat('<?php echo $this-> table->getName() ?>[%s]');33 $this->widgetSchema->setNameFormat('<?php echo $this->underscore($this->table->getPhpName()) ?>[%s]'); 34 34 35 35 $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); … … 61 61 62 62 <?php foreach ($this->getManyToManyTables() as $tables): ?> 63 if (isset($this->widgetSchema['<?php echo $t ables['middleTable']->getName() ?>_list']))63 if (isset($this->widgetSchema['<?php echo $this->underscore($tables['middleTable']->getPhpName()) ?>_list'])) 64 64 { 65 65 $values = array(); … … 69 69 } 70 70 71 $this->setDefault('<?php echo $t ables['middleTable']->getName() ?>_list', $values);71 $this->setDefault('<?php echo $this->underscore($tables['middleTable']->getPhpName()) ?>_list', $values); 72 72 } 73 73 … … 92 92 } 93 93 94 if (!isset($this->widgetSchema['<?php echo $t ables['middleTable']->getName() ?>_list']))94 if (!isset($this->widgetSchema['<?php echo $this->underscore($tables['middleTable']->getPhpName()) ?>_list'])) 95 95 { 96 96 // somebody has unset this widget … … 107 107 <?php echo $tables['middleTable']->getPhpName() ?>Peer::doDelete($c, $con); 108 108 109 $values = $this->getValue('<?php echo $t ables['middleTable']->getName() ?>_list');109 $values = $this->getValue('<?php echo $this->underscore($tables['middleTable']->getPhpName()) ?>_list'); 110 110 if (is_array($values)) 111 111 { branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php
r8484 r8508 365 365 foreach ($this->getManyToManyTables() as $tables) 366 366 { 367 if (($m = strlen($t ables['middleTable']->getName().'_list')) > $max)367 if (($m = strlen($this->underscore($tables['middleTable']->getPhpName()).'_list')) > $max) 368 368 { 369 369 $max = $m; … … 423 423 { 424 424 return call_user_func(array($this->table->getPhpName().'Peer', 'getI18nModel')); 425 } 426 427 public function underscore($name) 428 { 429 return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), '\\1_\\2', $name)); 425 430 } 426 431

