本文整理汇总了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;
}