本文整理匯總了PHP中Doctrine\ORM\ORMException::invalidMagicCall方法的典型用法代碼示例。如果您正苦於以下問題:PHP ORMException::invalidMagicCall方法的具體用法?PHP ORMException::invalidMagicCall怎麽用?PHP ORMException::invalidMagicCall使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ORM\ORMException
的用法示例。
在下文中一共展示了ORMException::invalidMagicCall方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: resolveMagicCall
/**
* Resolves a magic method call to the proper existent method at `EntityRepository`.
*
* @param string $method The method to call
* @param string $by The property name used as condition
* @param array $arguments The arguments to pass at method call
*
* @throws ORMException If the method called is invalid or the requested field/association does not exist
*
* @return mixed
*/
private function resolveMagicCall($method, $by, array $arguments)
{
if (!$arguments) {
throw ORMException::findByRequiresParameter($method . $by);
}
$fieldName = lcfirst(Inflector::classify($by));
if (!($this->_class->hasField($fieldName) || $this->_class->hasAssociation($fieldName))) {
throw ORMException::invalidMagicCall($this->_entityName, $fieldName, $method . $by);
}
return $this->{$method}([$fieldName => $arguments[0]], ...array_slice($arguments, 1));
}