1
0
mirror of synced 2025-01-18 22:41:43 +03:00

Small fixes, now it should be possible to add custom errors

This commit is contained in:
zYne 2006-10-08 18:20:10 +00:00
parent 67da38b07d
commit 11206fe573
2 changed files with 13 additions and 4 deletions

View File

@ -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);

View File

@ -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);
}
}