Development

Changeset 7153

You must first sign up to be able to contribute.

Changeset 7153

Show
Ignore:
Timestamp:
01/22/08 15:20:13 (7 months ago)
Author:
fabien
Message:

fixed default validator for primary keys in Propel generated forms

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php

    r7147 r7153  
    297297    } 
    298298 
    299     if (!$column->isPrimaryKey() && $column->isForeignKey()) 
     299    if ($column->isPrimaryKey() || $column->isForeignKey()) 
    300300    { 
    301301      $name = 'PropelChoice'; 
     
    329329    } 
    330330 
    331     if (!$column->isPrimaryKey() && $column->isForeignKey()) 
     331    if ($column->isForeignKey()) 
    332332    { 
    333333      $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()); 
    334338    } 
    335339 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crudBrowser.class.php

    r7147 r7153  
    152152    $this->test()->diag('save / validation'); 
    153153    $values = array( 
     154      'id'          => 1009299, 
    154155      'title'       => '', 
    155156      'body'        => 'my body', 
     
    157158      'category_id' => null, 
    158159      'end_date'    => array('year' => 0, 'month' => 0, 'day' => 15, 'hour' => '10', 'minute' => '20'), 
    159       'book_id'     => 14
     160      'book_id'     => 149999
    160161      'author_list' => array(0, 5), 
    161162    ); 
     
    169170      )-> 
    170171      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
    172173    ; 
    173174 
     
    175176    $this->test()->diag('save'); 
    176177    $this->saveValues($options, array( 
     178      'id'          => 3, 
    177179      'title'       => 'my title', 
    178180      'body'        => 'my body', 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseArticleForm.class.php

    r7147 r7153  
    2525 
    2626    $this->setValidators(array( 
    27       'id'          => new sfValidatorInteger(array('required' => false)), 
     27      'id'          => new sfValidatorPropelChoice(array('model' => 'Article', 'column' => 'Id', 'required' => false)), 
    2828      'title'       => new sfValidatorString(), 
    2929      'body'        => new sfValidatorString(array('required' => false)), 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseAuthorArticleForm.class.php

    r7147 r7153  
    1818 
    1919    $this->setValidators(array( 
    20       'author_id'  => new sfValidatorInteger(array('required' => false)), 
    21       'article_id' => new sfValidatorInteger(array('required' => false)), 
     20      'author_id'  => new sfValidatorPropelChoice(array('model' => 'Author', 'required' => false)), 
     21      'article_id' => new sfValidatorPropelChoice(array('model' => 'Article', 'required' => false)), 
    2222    )); 
    2323 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseAuthorForm.class.php

    r7147 r7153  
    1919 
    2020    $this->setValidators(array( 
    21       'id'           => new sfValidatorInteger(array('required' => false)), 
     21      'id'           => new sfValidatorPropelChoice(array('model' => 'Author', 'column' => 'Id', 'required' => false)), 
    2222      'name'         => new sfValidatorString(array('required' => false)), 
    2323      '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  
    1818 
    1919    $this->setValidators(array( 
    20       'id'   => new sfValidatorInteger(array('required' => false)), 
     20      'id'   => new sfValidatorPropelChoice(array('model' => 'Book', 'column' => 'Id', 'required' => false)), 
    2121      'name' => new sfValidatorString(array('required' => false)), 
    2222    )); 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseCategoryForm.class.php

    r7147 r7153  
    1818 
    1919    $this->setValidators(array( 
    20       'id'   => new sfValidatorInteger(array('required' => false)), 
     20      'id'   => new sfValidatorPropelChoice(array('model' => 'Category', 'column' => 'Id', 'required' => false)), 
    2121      'name' => new sfValidatorString(array('required' => false)), 
    2222    ));