@param MetaInformationInterface $metaInformation
@param object                   $entity

@return boolean

@throws SolrException if callback method not exists
341059
private function addToIndex(MetaInformationInterface $metaInformation, $entity): bool
    {
        if (!$metaInformation->hasSynchronizationFilter()) {
            return true;
        }

        $callback = $metaInformation->getSynchronizationCallback();
        if (!method_exists($entity, $callback)) {
            throw new SolrException(sprintf('unknown method %s in entity %s', $callback, get_class($entity)));
        }

        return $entity->$callback();
    }
255319
public function getActionRequestMeta($action, Entity $entity = NULL, $method = \Psc\Net\HTTP\Request::GET) {
    if (!array_key_exists($action, $this->actionsRequestMeta)) {
      $idIsInt = ($identifierType = $this->getIdentifier()->getType()) instanceof IntegerType;
      $this->actionsRequestMeta[$action] = new RequestMeta($method,
                                               $this->constructUrl(array($this->getEntityName(), ($idIsInt ? '%d' : '%s'), $action)),
                                               array($identifierType)
                                              );
    }
    
    if (isset($entity)) {
      $meta = clone $this->actionsRequestMeta[$action];
      return $meta->setInput($entity->getIdentifier());
    } else {
      return $this->actionsRequestMeta[$action];
    }
  }
1219429
private function addListenerToEntityIfRequired(EntityInterface $entity): void
    {
        if (!$entity instanceof NotifyPropertyChanged) {
            return;
        }
        $listener = $this->entityManager->getUnitOfWork();
        $entity->addPropertyChangedListener($listener);
    }
1188238
public static function fromEntity(FieldMetadata $meta, $entity) {
        $instance = new static($meta, $entity->getAttribute($meta->name));

        return $instance;
    }
857409
public function getMethods($entity)
    {
        $reflectionClass = new \ReflectionClass($entity);

        $methods = [];
        foreach ($reflectionClass->getMethods() as $method) {
            /** @var Field $annotation */
            $annotation = $this->reader->getMethodAnnotation($method, self::FIELD_CLASS);

            if ($annotation === null) {
                continue;
            }

            $annotation->value = $method->invoke($entity);
            
            if ($annotation->name == '') {
                throw new SolrMappingException(sprintf('Please configure a field-name for method "%s" with field-annotation in class "%s"', $method->getName(), get_class($entity)));
            }

            $methods[] = $annotation;
        }

        return $methods;
    }
738519
protected void addEntityClassToDocument(EntityMetadata metadata, Object entity, Document document,
        final MetamodelImpl metaModel) {
        try {
            Field luceneField;
            Object id;
            id = PropertyAccessorHelper.getId(entity, metadata);

            // Indexing composite keys
            if (metaModel != null && metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) {
                id = KunderaCoreUtils.prepareCompositeKey(metadata.getIdAttribute(), metaModel, id);
            }

            luceneField =
                new Field(IndexingConstants.ENTITY_ID_FIELD, id.toString(), Field.Store.YES, Field.Index.ANALYZED);

            // luceneField.set
            // adding class
            // namespace
            // /*Field.Store.YES, Field.Index.ANALYZED_NO_NORMS*/);
            document.add(luceneField);

            // index namespace for unique deletion
            luceneField =
                new Field(IndexingConstants.KUNDERA_ID_FIELD, getKunderaId(metadata, id), Field.Store.YES,
                    Field.Index.ANALYZED); // adding
            // class
            // namespace
            // Field.Store.YES/*, Field.Index.ANALYZED_NO_NORMS*/);
            document.add(luceneField);

            // index entity class
            luceneField =
                new Field(IndexingConstants.ENTITY_CLASS_FIELD, metadata.getEntityClazz().getCanonicalName()
                    .toLowerCase(), Field.Store.YES, Field.Index.ANALYZED);
            document.add(luceneField);
            //
            luceneField = new Field("timestamp", System.currentTimeMillis() + "", Field.Store.YES, Field.Index.NO);
            document.add(luceneField);

            // index index name
            luceneField =
                new Field(IndexingConstants.ENTITY_INDEXNAME_FIELD, metadata.getIndexName(), Field.Store.NO,
                    Field.Index.ANALYZED_NO_NORMS);
            document.add(luceneField);

            luceneField =
                new Field(getCannonicalPropertyName(metadata.getEntityClazz().getSimpleName(),
                    ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName()), id.toString(),
                    Field.Store.YES, Field.Index.ANALYZED_NO_NORMS);
            document.add(luceneField);
        } catch (PropertyAccessException e) {
            throw new IllegalArgumentException("Id could not be read from object " + entity);
        }
    }
1086320
protected function checkIsCorrectEntityType(EntityInterface $entity): void
    {
        $entityFqn = $this->getEntityFqn();

        if (!$entity instanceof $entityFqn) {
            $class = \get_class($entity);
            $msg   = "[ $class ] is not an instance of [ $entityFqn ]";
            throw new DoctrineStaticMetaException($msg);
        }
    }
205296
private function getIndexableEntities($entity = null)
    {
        if ($entity) {
            return [$entity];
        }

        $entities = [];
        $namespaces = $this->getContainer()->get('solr.doctrine.classnameresolver.known_entity_namespaces');
        $metaInformationFactory = $this->getContainer()->get('solr.meta.information.factory');

        foreach ($namespaces->getEntityClassnames() as $classname) {
            try {
                $metaInformation = $metaInformationFactory->loadInformation($classname);
                if ($metaInformation->isNested()) {
                    continue;
                }

                array_push($entities, $metaInformation->getClassName());
            } catch (SolrMappingException $e) {
                continue;
            }
        }

        return $entities;
    }
787413
public function save(ClassMetadata $meta, Component $component, &$entity): bool
    {
        if (is_object($entity)) {
            return false;
        }

        $reflection = $meta->getReflectionClass();
        $constructor = $reflection->getConstructor();

        if ($constructor) {
            $constructorNewParameters = [];

            /** @var Container|null $baseComponent */
            $baseComponent = $component instanceof Container ? $component : $component->getParent();

            if ($baseComponent === null) {
                throw new InvalidStateException(__METHOD__ . ' cannot found container');
            }

            foreach ($constructor->getParameters() as $constructorParameter) {
                // property name
                $name = $constructorParameter->getName();

                /** @var BaseControl|Container|null $child */
                $child = $baseComponent->getComponent($name, false);

                // test if parameter is required and control exists
                if ($child === null && $constructorParameter->isOptional() === false) {
                    throw new InvalidStateException("Can't create new instance: control '$name' is missing");
                }

                if ($child === null) {
                    continue;
                }

                if ($meta->hasAssociation($name) === false) {
                    if ($child instanceof Container) {
                        throw new InvalidStateException('Scalar type and form container? What is wrong with you?');
                    }
                    // scalar type
                    $constructorNewParameters[$name] = $child->getValue();
                    continue;
                }

                // object type
                $targetClass = $meta->getAssociationTargetClass($name);

                if ($child instanceof Container) {
                    // probably OneToOne Container
                    $this->save($this->entityManager->getClassMetadata($targetClass), $child, $targetClass);
                    // $targetClass is new instance
                    $constructorNewParameters[$name] = $targetClass;
                } elseif ($child instanceof BaseControl) {
                    $constructorNewParameters[$name] = $this->entityManager->find($targetClass, $child->getValue());
                }
            }

            $entity = $reflection->newInstanceArgs($constructorNewParameters);
        } else {
            $entity = $reflection->newInstanceWithoutConstructor();
        }

        return false;
    }
1268616
public static function metaForTemplateEntity(
        ClassMetadataBuilder $builder
    ): void {
        $builder->addOwningOneToOne(
            TemplateEntity::getDoctrineStaticMeta()->getSingular(),
            TemplateEntity::class,
            self::getDoctrineStaticMeta()->getSingular()
        );
    }
959796
public function updateModelMetas( $model, $metas, $metaService ) {

		foreach( $metas as $meta ) {

			if( $meta->belongsTo( $model, static::$parentType ) ) {

				$metaService->update( $meta );
			}
		}

		return true;
	}
1124730
public function addMissingProperty(MetaEntityInterface $metaEntity, RelationMetaPropertyInterface $property)
    {
        $inversedBy = $property->getInversedBy();
        $mappedBy = $property->getMappedBy();
        if ($newPropertyName = $mappedBy ?: $inversedBy) {
            $inversedType = MetaPropertyFactory::getInversedType($property->getOrmType());
            /** @var RelationMetaPropertyInterface $newProperty */
            $newProperty = $this->metaPropertyFactory->createMetaProperty(
                $metaEntity,
                $inversedType,
                $newPropertyName
            );
            $newProperty->setTargetEntity($property->getMetaEntity());
            if ($inversedBy) {
                $newProperty->setMappedBy($property->getName());
            } else {
                $newProperty->setInversedBy($property->getName());
            }
        }
    }
776790
private function buildBodyRowAttr($entity, Metadata $meta)
    {
        $attr = [];

        foreach ($meta->getConfiguration()['index_view_row_attr'] as $property) {
            $attr['data-'.$property] = $this->propertyAccessor->getValue($entity, $property);
        }

        return $attr;
    }
1265030
public function injectEntityManager(EntityManagerInterface $entityManager, ClassMetadata $classMetadata) : void
    {
        if ($entityManager !== self::$entityManager) {
            throw new RuntimeException(
                'Trying to use PersistentObject with different EntityManager instances. ' .
                'Was PersistentObject::setEntityManager() called?'
            );
        }

        $this->cm = $classMetadata;
    }
286809
public function validate(EntityInterface $entity)
    {
        if (!$entity instanceof Attribution) {
            throw new Exception(
                sprintf('The Entity to validate must be an instance of %s', Attribution::class)
            );
        }

        $this->validateSource($entity->getSource());
        $this->validateTarget($entity->getTarget());
        $this->validateRole($entity->getRole());
        $errors = $this->getErrors();

        return empty($errors);
    }
874140
public function getQueryBuilder($entity): QueryBuilderInterface
    {
        $metaInformation = $this->metaInformationFactory->loadInformation($entity);

        return new QueryBuilder($this, $metaInformation);
    }
443846
private function recursivCompleteEntity($entity)
    {
        switch (true) {
            case is_a($entity, \RGU\Dvoconnector\Domain\Model\Meta\Association\Repertoire::class):

                return $this->metaRepository->findAssociationRepertoireByID($entity->getID());

                break;
            case is_a($entity, \RGU\Dvoconnector\Domain\Model\Meta\Association\Category::class):

                return $this->metaRepository->findAssociationCategoryByID($entity->getID());

                break;
            case is_a($entity, \RGU\Dvoconnector\Domain\Model\Meta\Association\Performancelevel::class):

                return $this->metaRepository->findAssociationPerformancelevelByID($entity->getID());

                break;
            case is_a($entity, \RGU\Dvoconnector\Domain\Model\Meta\Event\Type::class):

                return $this->metaRepository->findEventTypeByID($entity->getID());

                break;
            default:

                $classSchema = $this->reflectionService->getClassSchema(get_class($entity));

                foreach ($classSchema->getProperties() as $propertyName => $propertyDefinition) {
                    switch (true) {
                        case is_a($propertyDefinition['type'], \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class, true):

                            $objectStorage = $entity->_getProperty($propertyName);
                            $newObjectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();

                            $objectStorage->rewind();

                            while ($objectStorage->valid()) {
                                $subEntity = $objectStorage->current();

                                if (!is_null($subEntity)) {
                                    $newSubEntity = $this->recursivCompleteEntity($subEntity);
                                    if ($newSubEntity) {
                                        $newObjectStorage->attach($newSubEntity);
                                    } else {
                                        $newObjectStorage->attach($subEntity);
                                    }
                                }

                                $objectStorage->next();
                            }

                            $entity->_setProperty($propertyName, $newObjectStorage);

                            break;
                        case is_a($propertyDefinition['type'], \TYPO3\CMS\Extbase\DomainObject\AbstractEntity::class, true):

                            $subEntity = $entity->_getProperty($propertyName);

                            if (!is_null($subEntity)) {
                                $newSubEntity = $this->recursivCompleteEntity($subEntity);
                                $entity->_setProperty($propertyName, $newSubEntity);
                            }

                            break;
                    }
                }

                return $entity;

                break;
        }
    }