src/EntityQueryBuilder.php
protected function parseCallMethods($method, array $lists, array $arguments, $prefix = true)
    {
        $condition  = null;
        $fieldName  = null;
        $methodName = null;

        foreach ($lists as $name => $requireArgs) {
            if (strpos($method, 'and') === 0) {
                $method    = lcfirst(substr($method, 3));
                $condition = 'and';
            } elseif (strpos($method, 'or') === 0) {
                $method    = lcfirst(substr($method, 2));
                $condition = 'or';
            }

            if (strlen($method) < strlen($name)) {
                continue;
            }

            $position = false;

            if ($prefix && strpos($method, $name) === 0) {
                $position = 0;
            } elseif (!$prefix) {
                $position = strpos($method, $name, strlen($name));
            }

            if ($position !== false) {
                /** @noinspection IsEmptyFunctionUsageInspection */
                if ($requireArgs && empty($arguments)) {
                    throw ORMException::findByRequiresParameter(sprintf('%s::%s', static::class, $method));
                }

                if ($prefix) {
                    $fieldName  = substr($method, strlen($name));
                    $methodName = $name;
                } elseif (!$prefix) {
                    $fieldName  = substr($method, 0, $position);
                    $methodName = $name;
                }
                break;
            }
        }

        if ($fieldName && $methodName) {
            $fieldName     = lcfirst(Inflector::classify($fieldName));
            $className     = $this->getEntityClassName();
            $classMetadata = $this->getEntityManager()->getClassMetadata($className);

            if (!$classMetadata->hasField($fieldName) && !$classMetadata->hasAssociation($fieldName)) {
                throw ORMException::invalidFindByCall($className, $fieldName, $method);
            }
        }

        return [
            'condition'  => $condition,
            'fieldName'  => $fieldName,
            'methodName' => $methodName
        ];
    }
protected function parseCallMethods($method, array $lists, array $arguments, $prefix = true)
    {
        $condition  = null;
        $fieldName  = null;
        $methodName = null;

        foreach ($lists as $name => $requireArgs) {
            if (strpos($method, 'and') === 0) {
                $method    = lcfirst(substr($method, 3));
                $condition = 'and';
            } elseif (strpos($method, 'or') === 0) {
                $method    = lcfirst(substr($method, 2));
                $condition = 'or';
            }

            if (strlen($method) < strlen($name)) {
                continue;
            }

            $position = false;

            if ($prefix && strpos($method, $name) === 0) {
                $position = 0;
            } elseif (!$prefix) {
                $position = strpos($method, $name, strlen($name));
            }

            if ($position !== false) {
                /** @noinspection IsEmptyFunctionUsageInspection */
                if ($requireArgs && empty($arguments)) {
                    throw ORMException::findByRequiresParameter(sprintf('%s::%s', static::class, $method));
                }

                if ($prefix) {
                    $fieldName  = substr($method, strlen($name));
                    $methodName = $name;
                } elseif (!$prefix) {
                    $fieldName  = substr($method, 0, $position);
                    $methodName = $name;
                }
                break;
            }
        }

        if ($fieldName && $methodName) {
            $fieldName     = lcfirst(Inflector::classify($fieldName));
            $className     = $this->getEntityClassName();
            $classMetadata = $this->getEntityManager()->getClassMetadata($className);

            if (!$classMetadata->hasField($fieldName) && !$classMetadata->hasAssociation($fieldName)) {
                throw ORMException::invalidFindByCall($className, $fieldName, $method);
            }
        }

        return [
            'condition'  => $condition,
            'fieldName'  => $fieldName,
            'methodName' => $methodName
        ];
    }
A parseCallMethods function.

@param string $method
@param array  $lists
@param array  $arguments
@param bool   $prefix

@return array
@throws \Doctrine\ORM\ORMException