本文整理匯總了PHP中Doctrine\Common\Annotations\Reader::getResult方法的典型用法代碼示例。如果您正苦於以下問題:PHP Reader::getResult方法的具體用法?PHP Reader::getResult怎麽用?PHP Reader::getResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\Common\Annotations\Reader
的用法示例。
在下文中一共展示了Reader::getResult方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getResult
/**
* {@inheritdoc}
*/
public function getResult(ClassMetadata $classMetadata, array $options = [])
{
if (!isset($options['property'])) {
throw new \InvalidArgumentException('The property option was not specified.');
}
$instance = $classMetadata->newInstance();
if (!$this->propertyAccessor->isWritable($instance, $options['property']) || !$this->propertyAccessor->isReadable($instance, $options['property'])) {
return false;
}
if (isset($options['create'])) {
$create = $options['create'];
unset($options['create']);
} else {
$create = true;
}
if ($annotation = $this->annotationQuery->getResult($classMetadata, array_merge($options, ['annotationClass' => 'Sentient\\Data\\Metadata\\Annotation\\LockedProperty']))) {
if ($create ? $annotation->onCreate : $annotation->onUpdate) {
return false;
}
}
if ($annotation = $this->annotationQuery->getResult($classMetadata, array_merge($options, ['annotationClass' => 'Sentient\\Data\\Metadata\\Annotation\\CrudProperty']))) {
if ($annotation->editable === CrudProperty::EDITABLE_ALWAYS) {
return true;
}
if ($annotation->editable === CrudProperty::EDITABLE_NEVER) {
return false;
}
if ($annotation->editable === CrudProperty::EDITABLE_ON_CREATE) {
return $create;
}
if ($annotation->editable === CrudProperty::EDITABLE_ON_UPDATE) {
return !$create;
}
throw new \RuntimeException('The editable property has an invalid value.');
}
foreach ($this->bannedAnnotations as $annotationClass) {
if ($this->annotationQuery->getResult($classMetadata, array_merge($options, compact('annotationClass')))) {
return false;
}
}
return true;
}