public static function buildIndexClassesAndProperties($objectManager)
    {
        /** @var ReflectionService $reflectionService */
        $reflectionService = $objectManager->get(ReflectionService::class);

        $indexAnnotations = [];

        $annotationClassName = Indexable::class;
        foreach ($reflectionService->getClassNamesByAnnotation($annotationClassName) as $className) {
            if ($reflectionService->isClassAbstract($className)) {
                throw new ElasticSearchException(sprintf('The class with name "%s" is annotated with %s, but is abstract. Indexable classes must not be abstract.', $className, $annotationClassName), 1339595182);
            }
            $indexAnnotations[$className]['annotation'] = $reflectionService->getClassAnnotation($className, $annotationClassName);

            // if no single properties are set to be indexed, consider all properties to be indexed.
            $annotatedProperties = $reflectionService->getPropertyNamesByAnnotation($className, $annotationClassName);
            if (!empty($annotatedProperties)) {
                $indexAnnotations[$className]['properties'] = $annotatedProperties;
            } else {
                foreach ($reflectionService->getClassPropertyNames($className) as $propertyName) {
                    $indexAnnotations[$className]['properties'][] = $propertyName;
                }
            }
        }

        return $indexAnnotations;
    }
public static function buildIndexClassesAndProperties($objectManager)
    {
        /** @var ReflectionService $reflectionService */
        $reflectionService = $objectManager->get(ReflectionService::class);

        $indexAnnotations = [];

        $annotationClassName = Indexable::class;
        foreach ($reflectionService->getClassNamesByAnnotation($annotationClassName) as $className) {
            if ($reflectionService->isClassAbstract($className)) {
                throw new ElasticSearchException(sprintf('The class with name "%s" is annotated with %s, but is abstract. Indexable classes must not be abstract.', $className, $annotationClassName), 1339595182);
            }
            $indexAnnotations[$className]['annotation'] = $reflectionService->getClassAnnotation($className, $annotationClassName);

            // if no single properties are set to be indexed, consider all properties to be indexed.
            $annotatedProperties = $reflectionService->getPropertyNamesByAnnotation($className, $annotationClassName);
            if (!empty($annotatedProperties)) {
                $indexAnnotations[$className]['properties'] = $annotatedProperties;
            } else {
                foreach ($reflectionService->getClassPropertyNames($className) as $propertyName) {
                    $indexAnnotations[$className]['properties'][] = $propertyName;
                }
            }
        }

        return $indexAnnotations;
    }
public static function buildIndexClassesAndProperties ( $ objectManager ) { /** @var ReflectionService $reflectionService */ $ reflectionService = $ objectManager -> get ( ReflectionService :: class ) ; $ indexAnnotations = [ ] ; $ annotationClassName = Indexable :: class ; foreach ( $ reflectionService -> getClassNamesByAnnotation ( $ annotationClassName ) as $ className ) { if ( $ reflectionService -> isClassAbstract ( $ className ) ) { throw new ElasticSearchException ( sprintf ( 'The class with name "%s" is annotated with %s, but is abstract. Indexable classes must not be abstract.' , $ className , $ annotationClassName ) , 1339595182 ) ; } $ indexAnnotations [ $ className ] [ 'annotation' ] = $ reflectionService -> getClassAnnotation ( $ className , $ annotationClassName ) ; // if no single properties are set to be indexed, consider all properties to be indexed. $ annotatedProperties = $ reflectionService -> getPropertyNamesByAnnotation ( $ className , $ annotationClassName ) ; if ( ! empty ( $ annotatedProperties ) ) { $ indexAnnotations [ $ className ] [ 'properties' ] = $ annotatedProperties ; } else { foreach ( $ reflectionService -> getClassPropertyNames ( $ className ) as $ propertyName ) { $ indexAnnotations [ $ className ] [ 'properties' ] [ ] = $ propertyName ; } } } return $ indexAnnotations ; }
Creates the source array of what classes and properties have to be annotated.
The returned array consists of class names, with a sub-key having both 'annotation' and 'properties' set.
The annotation contains the class's annotation, while properties contains each property that has to be indexed.
Each property might either have TRUE as value, or also an annotation instance, if given.

@param ObjectManagerInterface $objectManager
@return array
@throws ElasticSearchException
Creates the source array of what classes and properties have to be annotated . The returned array consists of class names with a sub - key having both annotation and properties set . The annotation contains the class s annotation while properties contains each property that has to be indexed . Each property might either have TRUE as value or also an annotation instance if given .