本文整理匯總了PHP中Doctrine\ORM\ORMException::invalidEntityRepository方法的典型用法代碼示例。如果您正苦於以下問題:PHP ORMException::invalidEntityRepository方法的具體用法?PHP ORMException::invalidEntityRepository怎麽用?PHP ORMException::invalidEntityRepository使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ORM\ORMException
的用法示例。
在下文中一共展示了ORMException::invalidEntityRepository方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setDefaultRepositoryClassName
/**
* Set default repository class.
*
* @since 2.2
* @param string $className
* @throws ORMException If not is a \Doctrine\ORM\EntityRepository
*/
public function setDefaultRepositoryClassName($className)
{
$entityRepositoryClassName = 'Doctrine\\ORM\\EntityRepository';
if ($className !== $entityRepositoryClassName && !is_subclass_of($className, $entityRepositoryClassName)) {
throw ORMException::invalidEntityRepository($className);
}
$this->_attributes['defaultRepositoryClassName'] = $className;
}
示例2: setDefaultRepositoryClassName
/**
* Sets default repository class.
*
* @since 2.2
*
* @param string $className
*
* @return void
*
* @throws ORMException If not is a \Doctrine\Common\Persistence\ObjectRepository
*/
public function setDefaultRepositoryClassName($className)
{
$reflectionClass = new \ReflectionClass($className);
if (!$reflectionClass->implementsInterface('Doctrine\\Common\\Persistence\\ObjectRepository')) {
throw ORMException::invalidEntityRepository($className);
}
$this->_attributes['defaultRepositoryClassName'] = $className;
}
示例3: setDefaultRepositoryClassName
/**
* Sets default repository class.
*
* @since 2.2
*
* @param string $className
*
* @return void
*
* @throws ORMException If not is a \Doctrine\Common\Persistence\ObjectRepository
*/
public function setDefaultRepositoryClassName($className)
{
$reflectionClass = new \ReflectionClass($className);
if (!$reflectionClass->implementsInterface(ObjectRepository::class)) {
throw ORMException::invalidEntityRepository($className);
}
$this->_attributes['defaultRepositoryClassName'] = $className;
}