@param ClassMetadata $targetEntity
@param string        $targetTableAlias

@throws \ReflectionException

@return string
163252
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
    {
        $class = $targetEntity->getName();

        if (\count($this->enabled) && !(\array_key_exists($class, $this->enabled) && true === $this->enabled[$class])) {
            return '';
        }

        if (\array_key_exists($class, $this->disabled) && true === $this->disabled[$class]) {
            return '';
        }

        if (\array_key_exists($targetEntity->rootEntityName, $this->disabled) && true === $this->disabled[$targetEntity->rootEntityName]) {
            return '';
        }

        $em = $this->getEntityManager();

        $config = $this->getListener()->getConfiguration($em, $targetEntity->name);

        if (!isset($config['softDeleteable']) || !$config['softDeleteable']) {
            return '';
        }

        /** @var \Doctrine\DBAL\Connection $conn */
        $conn = $em->getConnection();

        $platform = $conn->getDatabasePlatform();

        $quoteStrategy = $em->getConfiguration()->getQuoteStrategy();

        $column = $quoteStrategy->getColumnName($config['fieldName'], $targetEntity, $platform);

        $addCondSql = $platform->getIsNotNullExpression($targetTableAlias . '.' . $column);

        if (!empty($config['timeAware'])) {
            $now = $conn->quote(date('Y-m-d H:i:s')); // should use UTC in database and PHP
            $addCondSql = "({$addCondSql} OR {$targetTableAlias}.{$column} > {$now})";
        }

        return $addCondSql;
    }
174337
public static function getClassMetadataFromJoinAlias(string $alias, QueryBuilder $queryBuilder, ManagerRegistry $managerRegistry): ClassMetadata
    {
        @trigger_error(sprintf('The use of "%s::getClassMetadataFromJoinAlias()" is deprecated since 2.4 and will be removed in 3.0. Use "%s::getEntityClassByAlias()" instead.', __CLASS__, QueryBuilderHelper::class), E_USER_DEPRECATED);

        $entityClass = QueryBuilderHelper::getEntityClassByAlias($alias, $queryBuilder, $managerRegistry);

        return $managerRegistry
            ->getManagerForClass($entityClass)
            ->getClassMetadata($entityClass);
    }
343607
private String getTargetEntity(List<? extends AnnotationMirror> annotations) {
		String fullyQualifiedTargetEntityName = null;
		for ( AnnotationMirror mirror : annotations ) {
			if ( TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ELEMENT_COLLECTION ) ) {
				fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "targetClass" );
			}
			else if ( TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ONE_TO_MANY )
					|| TypeUtils.isAnnotationMirrorOfType( mirror, Constants.MANY_TO_MANY )
					|| TypeUtils.isAnnotationMirrorOfType( mirror, Constants.MANY_TO_ONE )
					|| TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ONE_TO_ONE ) ) {
				fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "targetEntity" );
			}
			else if ( TypeUtils.isAnnotationMirrorOfType( mirror, ORG_HIBERNATE_ANNOTATIONS_TARGET ) ) {
				fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "value" );
			}
		}
		return fullyQualifiedTargetEntityName;
	}
1315136
public static function getIdentifier(ClassMetadata $targetEntity)
    {
        if (!isset(self::$cacheIdentifiers[$targetEntity->getName()])) {
            $identifier = $targetEntity->getIdentifierFieldNames();
            self::$cacheIdentifiers[$targetEntity->getName()] = 0 < \count($identifier)
                ? $identifier[0]
                : 'id';
        }

        return self::$cacheIdentifiers[$targetEntity->getName()];
    }
1350801
@SuppressWarnings({ "unchecked", "rawtypes" })
	public <T, I extends Serializable, D, J extends Serializable> RelationshipRepositoryStub<T, I, D, J> getQueryParamsRepository(Class<T> sourceClass, Class<D> targetClass) {
		init();

		RegistryEntry entry = resourceRegistry.findEntry(sourceClass);

		RelationshipRepositoryAdapter repositoryAdapter = entry.getRelationshipRepositoryForClass(targetClass, null);
		return (RelationshipRepositoryStub<T, I, D, J>) repositoryAdapter.getRelationshipRepository();
	}
435204
public function canConvertFrom($source, $targetType)
    {
        if ((
            $this->reflectionService->isClassAnnotatedWith($targetType, Flow\Entity::class) ||
            $this->reflectionService->isClassAnnotatedWith($targetType, Flow\ValueObject::class) ||
            $this->reflectionService->isClassAnnotatedWith($targetType, Entity::class)
        ) === true) {
            return false;
        }

        $methodParameters = $this->reflectionService->getMethodParameters($targetType, '__construct');
        if (count($methodParameters) !== 1) {
            return false;
        }
        $methodParameter = array_shift($methodParameters);
        return TypeHandling::normalizeType($methodParameter['type']) === gettype($source);
    }
1115999
public function setTargetEntity(\ZF\Doctrine\Audit\Entity\TargetEntity $targetEntity)
    {
        $this->targetEntity = $targetEntity;

        return $this;
    }
1352007
public void registerClonedEntity(String sourceEntityId, String targetEntityId) {

        CmsEntityBackend.getInstance().getEntity(sourceEntityId).createDeepCopy(targetEntityId);
    }
104766
public static function mergeArrayIntoEntity($targetEntity, $array)
    {
        foreach ($array as $property => $value) {
            if (!empty($value)) {
                if (is_a($targetEntity->{'get' . ucfirst($property)}(),
                    '\\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage')
                ) {
                    $targetEntity->{'set' . ucfirst($property)}(new ObjectStorage());
                    if (is_array($value)) {
                        $singular = (preg_match('~s$~i', $property) > 0) ? rtrim($property, 's') : sprintf('%ss',
                            $property);
                        foreach ($value as $item) {
                            $targetEntity->{'add' . ucfirst($singular)}($item);
                        }
                    }
                } else {
                    $targetEntity->{'set' . ucfirst($property)}($value);
                }
            }
        }

        return $targetEntity;
    }
706312
public static function getMockZeroId(ClassMetadata $targetEntity)
    {
        if (!isset(self::$cacheZeroIds[$targetEntity->getName()])) {
            $type = self::getIdentifierType($targetEntity);
            self::$cacheZeroIds[$targetEntity->getName()] = self::findZeroIdValue($type);
        }

        return self::$cacheZeroIds[$targetEntity->getName()];
    }
837842
protected function handleDataPreProcessor($source, $targetType, $currentPropertyPath)
    {
        if ($this->serviceFactory->has(ServiceInterface::SERVICE_DATA_PRE_PROCESSOR)) {
            /** @var DataPreProcessorService $dataProcessorService */
            $dataProcessorService = $this->serviceFactory->get(ServiceInterface::SERVICE_DATA_PRE_PROCESSOR);

            $processor = $dataProcessorService->getDataPreProcessor($source, $targetType);
            $source = $processor->getData();
            $processorResult = $processor->getResult();

            if ($processorResult->hasErrors()) {
                $this->messages->forProperty(implode('.', $currentPropertyPath))->merge($processorResult);
            }
        }

        return $source;
    }
451918
protected function getStructureCommand($mysqlArguments, $tableLikes, $targetFile)
    {
        $dataTables = ' `mysql -N ' . $mysqlArguments . ' -e "SHOW TABLES WHERE (' . implode(' OR ', $tableLikes) . ')" | awk \'{printf $1" "}\'`';

        return 'mysqldump --no-data --single-transaction ' . $mysqlArguments . ' --skip-add-drop-table ' . $dataTables .
            ' | sed "s/^CREATE TABLE/CREATE TABLE IF NOT EXISTS/g"' .
            ' | gzip >> ' . $targetFile;
    }
1336018
public function buildJunctionJoinColumnName(\ReflectionClass $targetClass, string $targetIdPropertyName,
			string $joinColumnName = null): string {
		if ($joinColumnName !== null) return $joinColumnName;
	
		return $targetClass->getShortName() . $targetIdPropertyName;
	}
1088686
protected function callSpecifiedMethod(
        ReflectionMethod $reflectedMethod, 
        $targetObject, 
        $paramsWithSelectors
    ) {
        $args = $this->paramListGenerator->getOrderedListOfArgumentValue(
            $reflectedMethod,
            $paramsWithSelectors
        );
        return $reflectedMethod->invokeArgs($targetObject, $args);
    }
1111028
public function getAssociationsByTargetClass($targetClass)
    {
        $relations = array();
        foreach ($this->associationMappings as $mapping) {
            if ($mapping['targetEntity'] == $targetClass) {
                $relations[$mapping['fieldName']] = $mapping;
            }
        }
        return $relations;
    }
1246339
public function addOneToMany($name, $targetEntity, $mappedBy)
    {
        $builder = $this->createOneToMany($name, $targetEntity);
        $builder->mappedBy($mappedBy);

        return $builder->build();
    }
1215287
private Entity toMappingTargetEntity(
      MappingTarget mappingTarget, List<Entity> entityMappingEntities) {
    Entity mappingTargetEntity = new DynamicEntity(mappingTargetMetaData);
    mappingTargetEntity.set(MappingProjectMetadata.IDENTIFIER, mappingTarget.getIdentifier());
    mappingTargetEntity.set(MappingTargetMetadata.TARGET, mappingTarget.getTarget().getId());
    mappingTargetEntity.set(MappingTargetMetadata.ENTITY_MAPPINGS, entityMappingEntities);
    return mappingTargetEntity;
  }