Neos\Flow\Reflection\ReflectionService::getClassNamesByAnnotation PHP Method

getClassNamesByAnnotation() public method

Searches for and returns all names of classes which are tagged by the specified annotation. If no classes were found, an empty array is returned.
public getClassNamesByAnnotation ( string $annotationClassName ) : array
$annotationClassName string Name of the annotation class, for example "Neos\Flow\Annotations\Aspect"
return array
    public function getClassNamesByAnnotation($annotationClassName)
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        $annotationClassName = $this->cleanClassName($annotationClassName);
        return isset($this->annotatedClasses[$annotationClassName]) ? array_keys($this->annotatedClasses[$annotationClassName]) : [];
    }

Usage Example

 /**
  * This method is used to optimize the matching process.
  *
  * @param \Neos\Flow\Aop\Builder\ClassNameIndex $classNameIndex
  * @return \Neos\Flow\Aop\Builder\ClassNameIndex
  */
 public function reduceTargetClassNames(\Neos\Flow\Aop\Builder\ClassNameIndex $classNameIndex)
 {
     $classNames = $this->reflectionService->getClassNamesByAnnotation(Flow\ValueObject::class);
     $annotatedIndex = new \Neos\Flow\Aop\Builder\ClassNameIndex();
     $annotatedIndex->setClassNames($classNames);
     return $classNameIndex->intersect($annotatedIndex);
 }
All Usage Examples Of Neos\Flow\Reflection\ReflectionService::getClassNamesByAnnotation
ReflectionService