1
0
mirror of synced 2025-01-31 04:21:44 +03:00

Update ORMInvalidArgumentException.php

`@return self` trend break with `@return ORMInvalidArgumentException`
This commit is contained in:
flip111 2015-01-13 19:59:07 +01:00 committed by Marco Pivetta
parent 88e071d22d
commit 04e4940607

View File

@ -187,6 +187,28 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
return new self("Binding entities to query parameters only allowed for entities that have an identifier.");
}
/**
* @param object $relation
* @param string $fieldname
* @param mixed $value
* @return self
*/
public static function invalidAssociation($relation, $fieldname, $value)
{
return new self(sprintf('Expected an Object for relation %s::%s got %s instead.', get_class($relation), $fieldname, gettype($value)));
}
/**
* @param mixed $entry
* @return self
*/
public static function invalidAssociation($entry)
{
$ex = new self(gettype($entry) . (is_scalar($entry) ? ' "'.$entry.'"': '') . ' is not an Object.');
$ex->value = $entry;
return $ex;
}
/**
* Helper method to show an object as string.
*
@ -198,20 +220,4 @@ 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;
}
}