protected function getPropertyNameWithAlias($propertyPath)
    {
        $aliases = $this->queryBuilder->getRootAliases();
        $previousJoinAlias = $aliases[0];
        if (strpos($propertyPath, '.') === false) {
            return $previousJoinAlias . '.' . $propertyPath;
        }

        $propertyPathParts = explode('.', $propertyPath);
        $conditionPartsCount = count($propertyPathParts);
        for ($i = 0; $i < $conditionPartsCount - 1; $i++) {
            $joinProperty = $previousJoinAlias . '.' . $propertyPathParts[$i];
            $joinAlias = array_search($joinProperty, (array)$this->joins);
            if ($joinAlias === false) {
                $joinAlias = $propertyPathParts[$i] . $this->joinAliasCounter++;
                $this->queryBuilder->leftJoin($joinProperty, $joinAlias);
                $this->joins[$joinAlias] = $joinProperty;
            }
            $previousJoinAlias = $joinAlias;
        }

        return $previousJoinAlias . '.' . $propertyPathParts[$i];
    }