Commit 11206fe5 authored by zYne's avatar zYne

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

parent 67da38b0
...@@ -834,7 +834,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -834,7 +834,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$saveLater = $conn->saveRelated($this); $saveLater = $conn->saveRelated($this);
if( ! $this->isValid()) { $this->isValid();
if($this->errorStack->count() > 0) {
$conn->getTransaction()->addInvalid($this); $conn->getTransaction()->addInvalid($this);
} else { } else {
$conn->save($this); $conn->save($this);
......
...@@ -26,7 +26,7 @@ Doctrine::autoload('Doctrine_Access'); ...@@ -26,7 +26,7 @@ Doctrine::autoload('Doctrine_Access');
* @license LGPL * @license LGPL
* @package Doctrine * @package Doctrine
*/ */
class Doctrine_Validator_ErrorStack extends Doctrine_Access { class Doctrine_Validator_ErrorStack extends Doctrine_Access implements Countable, IteratorAggregate {
private $errors = array(); private $errors = array();
...@@ -42,8 +42,15 @@ class Doctrine_Validator_ErrorStack extends Doctrine_Access { ...@@ -42,8 +42,15 @@ class Doctrine_Validator_ErrorStack extends Doctrine_Access {
return null; return null;
} }
public function set($name, $value) { 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);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment