1
0
mirror of synced 2025-02-20 22:23:14 +03:00

Added new exception constructors

This commit is contained in:
flip111 2015-01-13 10:11:57 +01:00 committed by Marco Pivetta
parent 00a2c8e09c
commit b120dafb70

View File

@ -198,4 +198,20 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
{
return method_exists($obj, '__toString') ? (string)$obj : get_class($obj).'@'.spl_object_hash($obj);
}
/**
* @return ORMInvalidArgumentException
*/
public static function invalidAssociation($relation, $fieldname, $value) {
return new self('Expected an Object for relation '.get_class($relation).'::'.$fieldname.' got '.gettype($value).' instead.');
}
/**
* @return ORMInvalidArgumentException
*/
public static function invalidAssociation($entry) {
$ex = new self(gettype($entry) . ' is not an Object.');
$ex->value = $entry;
return $ex;
}
}