eZ\Publish\Core\Persistence\Doctrine\DoctrineExpression::in PHP Method

in() public method

. in() accepts an arbitrary number of parameters. The first parameter must always specify the value that should be matched against. Successive parameters must contain a logical expression or an array with logical expressions. These expressions will be matched against the first parameter. Example: $q->select( '*' )->from( 'table' ) ->where( $q->expr->in( 'id', 1, 2, 3 ) );
public in ( string $column ) : string
$column string the value that should be matched against
return string logical expression
    public function in($column)
    {
        $args = func_get_args();
        if (count($args) < 2) {
            throw new QueryException('Expected two or more parameters to in()');
        }
        if (is_array($args[1])) {
            $values = array_values($args[1]);
        } else {
            $values = array_slice($args, 1);
        }
        // Special handling of sub selects to avoid double braces
        if (count($values) === 1 && $values[0] instanceof SubselectDoctrineQuery) {
            return "{$column} IN " . $values[0]->getQuery();
        }
        if (count($values) == 0) {
            throw new QueryException('At least one element is required as value.');
        }
        foreach ($values as $key => $value) {
            switch (true) {
                case $value instanceof SubselectDoctrineQuery:
                    $values[$key] = $value->getQuery();
                    break;
                case is_int($value):
                case is_float($value):
                    $values[$key] = (string) $value;
                    break;
                default:
                    $values[$key] = $this->connection->quote($value);
            }
        }
        return "{$column} IN ( " . implode(', ', $values) . ' )';
    }