|
Revision 15627, 1.2 kB
(checked in by Kris.Wallsmith, 4 years ago)
|
[1.1, 1.2, 1.3] fixed sfValidatorPropelChoice(Many) overrides some Criteria (closes #5924)
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfValidatorPropelChoiceMany extends sfValidatorPropelChoice |
|---|
| 20 |
{ |
|---|
| 21 |
|
|---|
| 22 |
* @see sfValidatorBase |
|---|
| 23 |
*/ |
|---|
| 24 |
protected function doClean($values) |
|---|
| 25 |
{ |
|---|
| 26 |
if (!is_array($values)) |
|---|
| 27 |
{ |
|---|
| 28 |
$values = array($values); |
|---|
| 29 |
} |
|---|
| 30 |
|
|---|
| 31 |
$criteria = is_null($this->getOption('criteria')) ? new Criteria() : clone $this->getOption('criteria'); |
|---|
| 32 |
$criteria->addAnd($this->getColumn(), $values, Criteria::IN); |
|---|
| 33 |
|
|---|
| 34 |
$objects = call_user_func(array($this->getOption('model').'Peer', 'doSelect'), $criteria, $this->getOption('connection')); |
|---|
| 35 |
|
|---|
| 36 |
if (count($objects) != count($values)) |
|---|
| 37 |
{ |
|---|
| 38 |
throw new sfValidatorError($this, 'invalid', array('value' => $values)); |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
return $values; |
|---|
| 42 |
} |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|