Changeset 10382
- Timestamp:
- 07/21/08 09:42:31 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/lib/plugins/sfPropelPlugin/lib/propel/validator/sfValidatorPropelUnique.class.php
r9666 r10382 44 44 * * column: The unique column name in Propel field name format (required) 45 45 * If the uniquess is for several columns, you can pass an array of field names 46 * * field Field name used by the form, other than the column name 46 47 * * primary_key: The primary key column name in Propel field name format (optional, will be introspected if not provided) 47 48 * You can also pass an array if the table has several primary keys … … 55 56 $this->addRequiredOption('model'); 56 57 $this->addRequiredOption('column'); 58 $this->addOption('field', null); 57 59 $this->addOption('primary_key', null); 58 60 $this->addOption('connection', null); … … 76 78 $this->setOption('column', array($this->getOption('column'))); 77 79 } 80 81 if (!is_array($field = $this->getOption('field'))) 82 { 83 $this->setOption('field', $field ? array($field) : array()); 84 } 85 $fields = $this->getOption('field'); 78 86 79 87 $criteria = new Criteria(); 80 foreach ($this->getOption('column') as $ column)88 foreach ($this->getOption('column') as $i => $column) 81 89 { 82 90 $colName = call_user_func(array($this->getOption('model').'Peer', 'translateFieldName'), $column, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME); 83 91 84 $criteria->add($colName, $values[ $column]);92 $criteria->add($colName, $values[isset($fields[$i]) ? $fields[$i] : $column]); 85 93 } 86 94

