Small fixes, now it should be possible to add custom errors
This commit is contained in:
parent
67da38b07d
commit
11206fe573
@ -834,7 +834,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
||||
|
||||
$saveLater = $conn->saveRelated($this);
|
||||
|
||||
if( ! $this->isValid()) {
|
||||
$this->isValid();
|
||||
|
||||
if($this->errorStack->count() > 0) {
|
||||
$conn->getTransaction()->addInvalid($this);
|
||||
} else {
|
||||
$conn->save($this);
|
||||
|
@ -26,7 +26,7 @@ Doctrine::autoload('Doctrine_Access');
|
||||
* @license LGPL
|
||||
* @package Doctrine
|
||||
*/
|
||||
class Doctrine_Validator_ErrorStack extends Doctrine_Access {
|
||||
class Doctrine_Validator_ErrorStack extends Doctrine_Access implements Countable, IteratorAggregate {
|
||||
|
||||
private $errors = array();
|
||||
|
||||
@ -42,8 +42,15 @@ class Doctrine_Validator_ErrorStack extends Doctrine_Access {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public function set($name, $value) {
|
||||
$this->errors[$name] = $value;
|
||||
$this->errors[$name] = $value;
|
||||
}
|
||||
|
||||
public function getIterator() {
|
||||
return new ArrayIterator($this->errors);
|
||||
}
|
||||
public function count() {
|
||||
return count($this->errors);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user