Development

Changeset 29661

You must first sign up to be able to contribute.

Changeset 29661

Show
Ignore:
Timestamp:
05/28/10 18:56:42 (2 years ago)
Author:
Kris.Wallsmith
Message:

[1.3, 1.4] changed generation of (non-foreign key) primary key form fields so validation will fail if the primary key is changed (closes #8639, refs #8704)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.3/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php

    r28900 r29661  
    406406    } 
    407407 
    408     if ($column->isPrimaryKey() || $column->isForeignKey()) 
     408    if ($column->isForeignKey()) 
    409409    { 
    410410      $validatorSubclass = 'DoctrineChoice'; 
     411    } 
     412    else if ($column->isPrimaryKey()) 
     413    { 
     414      $validatorSubclass = 'Choice'; 
    411415    } 
    412416 
     
    430434    else if ($column->isPrimaryKey()) 
    431435    { 
    432       $options[] = sprintf('\'model\' => $this->getModelName(), \'column\' => \'%s\'', $column->getFieldName()); 
     436      $options[] = sprintf('\'choices\' => array($this->getObject()->get(\'%s\')), \'empty_value\' => $this->getObject()->get(\'%1$s\')', $column->getFieldName()); 
    433437    } 
    434438    else 
  • branches/1.3/lib/plugins/sfPropelPlugin/lib/generator/sfPropelFormGenerator.class.php

    r24392 r29661  
    326326    } 
    327327 
    328     if ($column->isPrimaryKey() || $column->isForeignKey()) 
     328    if ($column->isForeignKey()) 
    329329    { 
    330330      $name = 'PropelChoice'; 
    331331    } 
     332    else if ($column->isPrimaryKey()) 
     333    { 
     334      $name = 'Choice'; 
     335    } 
    332336 
    333337    return sprintf('sfValidator%s', $name); 
     
    351355    else if ($column->isPrimaryKey()) 
    352356    { 
    353       $options[] = sprintf('\'model\' => \'%s\', \'column\' => \'%s\'', $column->getTable()->getClassname(), $this->translateColumnName($column)); 
     357      $options[] = sprintf('\'choices\' => array($this->getObject()->get%s()), \'empty_value\' => $this->getObject()->get%1$s()', $this->translateColumnName($column, false, BasePeer::TYPE_PHPNAME)); 
    354358    } 
    355359    else 
  • branches/1.4/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php

    r28900 r29661  
    406406    } 
    407407 
    408     if ($column->isPrimaryKey() || $column->isForeignKey()) 
     408    if ($column->isForeignKey()) 
    409409    { 
    410410      $validatorSubclass = 'DoctrineChoice'; 
     411    } 
     412    else if ($column->isPrimaryKey()) 
     413    { 
     414      $validatorSubclass = 'Choice'; 
    411415    } 
    412416 
     
    430434    else if ($column->isPrimaryKey()) 
    431435    { 
    432       $options[] = sprintf('\'model\' => $this->getModelName(), \'column\' => \'%s\'', $column->getFieldName()); 
     436      $options[] = sprintf('\'choices\' => array($this->getObject()->get(\'%s\')), \'empty_value\' => $this->getObject()->get(\'%1$s\')', $column->getFieldName()); 
    433437    } 
    434438    else 
  • branches/1.4/lib/plugins/sfPropelPlugin/lib/generator/sfPropelFormGenerator.class.php

    r24392 r29661  
    326326    } 
    327327 
    328     if ($column->isPrimaryKey() || $column->isForeignKey()) 
     328    if ($column->isForeignKey()) 
    329329    { 
    330330      $name = 'PropelChoice'; 
    331331    } 
     332    else if ($column->isPrimaryKey()) 
     333    { 
     334      $name = 'Choice'; 
     335    } 
    332336 
    333337    return sprintf('sfValidator%s', $name); 
     
    351355    else if ($column->isPrimaryKey()) 
    352356    { 
    353       $options[] = sprintf('\'model\' => \'%s\', \'column\' => \'%s\'', $column->getTable()->getClassname(), $this->translateColumnName($column)); 
     357      $options[] = sprintf('\'choices\' => array($this->getObject()->get%s()), \'empty_value\' => $this->getObject()->get%1$s()', $this->translateColumnName($column, false, BasePeer::TYPE_PHPNAME)); 
    354358    } 
    355359    else