Changeset 7153
- Timestamp:
- 01/22/08 15:20:13 (7 months ago)
- Files:
-
- branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php (modified) (2 diffs)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crudBrowser.class.php (modified) (4 diffs)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseArticleForm.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseAuthorArticleForm.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseAuthorForm.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseBookForm.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseCategoryForm.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php
r7147 r7153 297 297 } 298 298 299 if ( !$column->isPrimaryKey() &&$column->isForeignKey())299 if ($column->isPrimaryKey() || $column->isForeignKey()) 300 300 { 301 301 $name = 'PropelChoice'; … … 329 329 } 330 330 331 if ( !$column->isPrimaryKey() &&$column->isForeignKey())331 if ($column->isForeignKey()) 332 332 { 333 333 $options[] = sprintf('\'model\' => \'%s\'', $this->getForeignTable($column)->getPhpName()); 334 } 335 else if ($column->isPrimaryKey()) 336 { 337 $options[] = sprintf('\'model\' => \'%s\', \'column\' => \'%s\'', $column->getTable()->getPhpName(), $column->getPhpName()); 334 338 } 335 339 branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crudBrowser.class.php
r7147 r7153 152 152 $this->test()->diag('save / validation'); 153 153 $values = array( 154 'id' => 1009299, 154 155 'title' => '', 155 156 'body' => 'my body', … … 157 158 'category_id' => null, 158 159 'end_date' => array('year' => 0, 'month' => 0, 'day' => 15, 'hour' => '10', 'minute' => '20'), 159 'book_id' => 14 ,160 'book_id' => 149999, 160 161 'author_list' => array(0, 5), 161 162 ); … … 169 170 )-> 170 171 checkResponseElement('ul[class="error_list"] li:contains("Required.")', 2)-> 171 checkResponseElement('ul[class="error_list"] li:contains("Invalid.")', 3)172 checkResponseElement('ul[class="error_list"] li:contains("Invalid.")', 4) 172 173 ; 173 174 … … 175 176 $this->test()->diag('save'); 176 177 $this->saveValues($options, array( 178 'id' => 3, 177 179 'title' => 'my title', 178 180 'body' => 'my body', branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseArticleForm.class.php
r7147 r7153 25 25 26 26 $this->setValidators(array( 27 'id' => new sfValidator Integer(array('required' => false)),27 'id' => new sfValidatorPropelChoice(array('model' => 'Article', 'column' => 'Id', 'required' => false)), 28 28 'title' => new sfValidatorString(), 29 29 'body' => new sfValidatorString(array('required' => false)), branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseAuthorArticleForm.class.php
r7147 r7153 18 18 19 19 $this->setValidators(array( 20 'author_id' => new sfValidator Integer(array('required' => false)),21 'article_id' => new sfValidator Integer(array('required' => false)),20 'author_id' => new sfValidatorPropelChoice(array('model' => 'Author', 'required' => false)), 21 'article_id' => new sfValidatorPropelChoice(array('model' => 'Article', 'required' => false)), 22 22 )); 23 23 branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseAuthorForm.class.php
r7147 r7153 19 19 20 20 $this->setValidators(array( 21 'id' => new sfValidator Integer(array('required' => false)),21 'id' => new sfValidatorPropelChoice(array('model' => 'Author', 'column' => 'Id', 'required' => false)), 22 22 'name' => new sfValidatorString(array('required' => false)), 23 23 'article_list' => new sfValidatorPropelChoiceMany(array('model' => 'Article', 'required' => false)), branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseBookForm.class.php
r7147 r7153 18 18 19 19 $this->setValidators(array( 20 'id' => new sfValidator Integer(array('required' => false)),20 'id' => new sfValidatorPropelChoice(array('model' => 'Book', 'column' => 'Id', 'required' => false)), 21 21 'name' => new sfValidatorString(array('required' => false)), 22 22 )); branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseCategoryForm.class.php
r7147 r7153 18 18 19 19 $this->setValidators(array( 20 'id' => new sfValidator Integer(array('required' => false)),20 'id' => new sfValidatorPropelChoice(array('model' => 'Category', 'column' => 'Id', 'required' => false)), 21 21 'name' => new sfValidatorString(array('required' => false)), 22 22 ));