/**
  * @param ClassMetadata $targetEntity
  * @param string $targetEntityPropertyName
  * @return Query
  */
 protected function getSubselectQuery(ClassMetadata $targetEntity, $targetEntityPropertyName)
 {
     $subselectQuery = new Query($targetEntity->getAssociationTargetClass($targetEntityPropertyName));
     $propertyName = str_replace($targetEntityPropertyName . '.', '', $this->path);
     switch ($this->operator) {
         case '==':
             $subselectConstraint = $subselectQuery->equals($propertyName, $this->operand);
             break;
         case '!=':
             $subselectConstraint = $subselectQuery->logicalNot($subselectQuery->equals($propertyName, $this->operand));
             break;
         case '<':
             $subselectConstraint = $subselectQuery->lessThan($propertyName, $this->operand);
             break;
         case '>':
             $subselectConstraint = $subselectQuery->greaterThan($propertyName, $this->operand);
             break;
         case '<=':
             $subselectConstraint = $subselectQuery->lessThanOrEqual($propertyName, $this->operand);
             break;
         case '>=':
             $subselectConstraint = $subselectQuery->greaterThanOrEqual($propertyName, $this->operand);
             break;
         case 'like':
             $subselectConstraint = $subselectQuery->like($propertyName, $this->operand);
             break;
         case 'in':
             $subselectConstraint = $subselectQuery->in($propertyName, $this->operand);
             break;
     }
     $subselectQuery->matching($subselectConstraint);
     return $subselectQuery;
 }