Removed unecessary verification

This commit is contained in:
weryques 2017-12-12 12:16:17 -02:00
parent 876bd47539
commit 94d6ca8dc6
1 changed files with 3 additions and 7 deletions

View File

@ -75,7 +75,7 @@ class Entity_Factory {
if ($this->entity->validate()) {
$this->entity = $this->repository->insert($this->entity);
} else {
throw new \ErrorException('The entity wasn\'t validated.');
throw new \ErrorException('The entity wasn\'t validated.' . print_r( $this->entity->get_errors(), true));
}
} elseif (!empty($args) && !$is_validated_and_in_db){
@ -108,12 +108,8 @@ class Entity_Factory {
$this->entity->set_description( 'It is only for test' );
}
if ($this->entity->validate()) {
$this->entity = $this->repository->insert( $this->entity );
} else {
throw new \ErrorException('The entity wasn\'t validated.' . print_r( $this->entity->get_errors(), true));
}
$this->entity->validate();
$this->entity = $this->repository->insert( $this->entity );
} else {
throw new \InvalidArgumentException('One or more arguments are invalid.');
}