Commit 2d553941 authored by meus's avatar meus

fixed default error message for ValidatorException that list the classes that...

fixed default error message for ValidatorException that list the classes that have validation errors
parent f04948f3
...@@ -42,6 +42,7 @@ class Doctrine_Validator_Exception extends Doctrine_Exception implements Countab ...@@ -42,6 +42,7 @@ class Doctrine_Validator_Exception extends Doctrine_Exception implements Countab
public function __construct(array $invalid) public function __construct(array $invalid)
{ {
$this->invalid = $invalid; $this->invalid = $invalid;
parent::__construct($this->generateMessage());
} }
public function getInvalidRecords() public function getInvalidRecords()
...@@ -68,4 +69,14 @@ class Doctrine_Validator_Exception extends Doctrine_Exception implements Countab ...@@ -68,4 +69,14 @@ class Doctrine_Validator_Exception extends Doctrine_Exception implements Countab
return parent::__toString(); return parent::__toString();
} }
private function generateMessage()
{
$message = "";
foreach ($this->invalid as $record){
$message .= "Validaton error in class " . get_class($record) . " ";
}
return $message;
}
} }
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