protected function getSqlForManyToOneAndOneToOneRelationsWithoutPropertyPath(DoctrineSqlFilter $sqlFilter, QuoteStrategy $quoteStrategy, ClassMetadata $targetEntity, $targetTableAlias, $targetEntityPropertyName)
{
$associationMapping = $targetEntity->getAssociationMapping($targetEntityPropertyName);
$constraints = [];
foreach ($associationMapping['joinColumns'] as $joinColumn) {
$quotedColumnName = $quoteStrategy->getJoinColumnName($joinColumn, $targetEntity, $this->entityManager->getConnection()->getDatabasePlatform());
$propertyPointer = $targetTableAlias . '.' . $quotedColumnName;
$operandAlias = $this->operandDefinition;
if (is_array($this->operandDefinition)) {
$operandAlias = key($this->operandDefinition);
}
$currentReferencedOperandName = $operandAlias . $joinColumn['referencedColumnName'];
if (is_object($this->operand)) {
$operandMetadataInfo = $this->entityManager->getClassMetadata(TypeHandling::getTypeForValue($this->operand));
$currentReferencedValueOfOperand = $operandMetadataInfo->getFieldValue($this->operand, $operandMetadataInfo->getFieldForColumn($joinColumn['referencedColumnName']));
$this->setParameter($sqlFilter, $currentReferencedOperandName, $currentReferencedValueOfOperand, $associationMapping['type']);
} elseif (is_array($this->operandDefinition)) {
foreach ($this->operandDefinition as $operandIterator => $singleOperandValue) {
if (is_object($singleOperandValue)) {
$operandMetadataInfo = $this->entityManager->getClassMetadata(TypeHandling::getTypeForValue($singleOperandValue));
$currentReferencedValueOfOperand = $operandMetadataInfo->getFieldValue($singleOperandValue, $operandMetadataInfo->getFieldForColumn($joinColumn['referencedColumnName']));
$this->setParameter($sqlFilter, $operandIterator, $currentReferencedValueOfOperand, $associationMapping['type']);
} elseif ($singleOperandValue === null) {
$this->setParameter($sqlFilter, $operandIterator, null, $associationMapping['type']);
}
}
}
$constraints[] = $this->getConstraintStringForSimpleProperty($sqlFilter, $propertyPointer, $currentReferencedOperandName);
}
return ' (' . implode(' ) AND ( ', $constraints) . ') ';
}