/**
  * Performs conversion of JOIN statements
  */
 protected function addJoinStatements()
 {
     foreach ($this->tableAliases as $joinId => $joinAlias) {
         if (!empty($joinId)) {
             $parentJoinId = $this->getParentJoinIdentifier($joinId);
             $joinTableAlias = $this->tableAliases[$parentJoinId];
             $virtualRelation = array_search($parentJoinId, $this->virtualRelationsJoins);
             if (false !== $virtualRelation) {
                 $className = $this->getEntityClassName($virtualRelation);
                 $fieldName = $this->getFieldName($virtualRelation);
                 $joinTableAlias = $this->aliases[$this->virtualRelationProvider->getTargetJoinAlias($className, $fieldName, $this->getFieldName($joinId))];
             }
             if ($this->joinIdHelper->isUnidirectionalJoin($joinId)) {
                 $entityClassName = $this->getEntityClassName($joinId);
                 $joinFieldName = $this->getFieldName($joinId);
                 $this->addJoinStatement($this->getJoinType($joinId), $entityClassName, $joinAlias, Join::WITH, $this->getUnidirectionalJoinCondition($joinTableAlias, $joinFieldName, $joinAlias, $entityClassName));
             } elseif ($this->joinIdHelper->isUnidirectionalJoinWithCondition($joinId)) {
                 // such as "Entity:Name|left|WITH|t2.field = t1"
                 $entityClassName = $this->joinIdHelper->getUnidirectionalJoinEntityName($joinId);
                 $this->addJoinStatement($this->getJoinType($joinId), $entityClassName, $joinAlias, $this->getJoinConditionType($joinId), $this->getJoinCondition($joinId));
             } else {
                 // bidirectional
                 if (null === $this->getEntityClassName($joinId)) {
                     $join = $this->getJoin($joinId);
                 } else {
                     $join = sprintf('%s.%s', $joinTableAlias, $this->getFieldName($joinId));
                 }
                 $this->addJoinStatement($this->getJoinType($joinId), $join, $joinAlias, $this->getJoinConditionType($joinId), $this->getJoinCondition($joinId));
             }
         }
     }
 }
 /**
  * Performs conversion of JOIN statements
  */
 protected function addJoinStatements()
 {
     foreach ($this->tableAliases as $joinId => $joinAlias) {
         if (!empty($joinId)) {
             $joinTableAlias = $this->tableAliases[$this->getParentJoinIdentifier($joinId)];
             if ($this->joinIdHelper->isUnidirectionalJoin($joinId)) {
                 $entityClassName = $this->getEntityClassName($joinId);
                 $joinFieldName = $this->getFieldName($joinId);
                 $this->addJoinStatement($this->getJoinType($joinId), $entityClassName, $joinAlias, $this->getUnidirectionalJoinConditionType($joinId), $this->getUnidirectionalJoinCondition($joinTableAlias, $joinFieldName, $joinAlias));
             } elseif ($this->joinIdHelper->isUnidirectionalJoinWithCondition($joinId)) {
                 // such as "Entity:Name|left|WITH|t2.field = t1"
                 $entityClassName = $this->joinIdHelper->getUnidirectionalJoinEntityName($joinId);
                 $this->addJoinStatement($this->getJoinType($joinId), $entityClassName, $joinAlias, $this->getJoinConditionType($joinId), $this->getJoinCondition($joinId));
             } else {
                 // bidirectional
                 $join = null === $this->getEntityClassName($joinId) ? $this->getJoin($joinId) : sprintf('%s.%s', $joinTableAlias, $this->getFieldName($joinId));
                 $this->addJoinStatement($this->getJoinType($joinId), $join, $joinAlias, $this->getJoinConditionType($joinId), $this->getJoinCondition($joinId));
             }
         }
     }
 }
 /**
  * @dataProvider isUnidirectionalJoinWithConditionProvider
  */
 public function testIsUnidirectionalJoinWithCondition($joinId, $expected)
 {
     $this->assertEquals($expected, $this->helper->isUnidirectionalJoin($joinId));
 }