summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/orm/src/AliasedExpression.php
blob: ed733a237adecfd7abf3f40ff91b4cda8f34c25a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

namespace ipl\Orm;

use ipl\Sql\Expression;

class AliasedExpression extends Expression
{
    /** @var string */
    protected $alias;

    /**
     * Create a new database expression
     *
     * @param string $alias     The alias to use for the expression, this is expected to be quoted and qualified
     * @param string $statement The statement of the expression
     * @param ?array $columns   The columns used by the expression
     * @param mixed ...$values  The values for the expression
     */
    public function __construct(string $alias, string $statement, array $columns = null, ...$values)
    {
        parent::__construct($statement, $columns, ...$values);

        $this->alias = $alias;
    }

    /**
     * Get this expression's alias
     *
     * @return string
     */
    public function getAlias(): string
    {
        return $this->alias;
    }
}