. */ Doctrine::autoload('Doctrine_Exception'); /** * Doctrine_Validator_Exception * * @author Konsta Vesterinen * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @package Doctrine * @category Object Relational Mapping * @link www.phpdoctrine.com * @since 1.0 * @version $Revision$ */ class Doctrine_Validator_Exception extends Doctrine_Exception implements Countable, IteratorAggregate { /** * @var array $invalid */ private $invalid = array(); /** * @param Doctrine_Validator $validator */ public function __construct(array $invalid) { $this->invalid = $invalid; parent::__construct($this->generateMessage()); } public function getInvalidRecords() { return $this->invalid; } public function getIterator() { return new ArrayIterator($this->invalid); } public function count() { return count($this->invalid); } /** * __toString * * @return string */ public function __toString() { return parent::__toString(); } private function generateMessage() { $message = ""; foreach ($this->invalid as $record){ $message .= "Validaton error in class " . get_class($record) . " "; } return $message; } }