| 1 |
<?php |
| 2 |
|
| 3 |
namespace ipl\Orm; |
| 4 |
|
| 5 |
use ipl\Sql\Expression; |
| 6 |
|
| 7 |
class AliasedExpression extends Expression |
| 8 |
{ |
| 9 |
/** @var string */ |
| 10 |
protected string $alias; |
| 11 |
|
| 12 |
/** |
| 13 |
* Create a new database expression |
| 14 |
* |
| 15 |
* @param string $alias The alias to use for the expression, this is expected to be quoted and qualified |
| 16 |
* @param string $statement The statement of the expression |
| 17 |
* @param ?array $columns The columns used by the expression |
| 18 |
* @param mixed ...$values The values for the expression |
| 19 |
*/ |
| 20 |
public function __construct(string $alias, string $statement, ?array $columns = null, ...$values) |
| 21 |
{ |
| 22 |
parent::__construct($statement, $columns, ...$values); |
| 23 |
|
| 24 |
$this->alias = $alias; |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Get this expression's alias |
| 29 |
* |
| 30 |
* @return string |
| 31 |
*/ |
| 32 |
public function getAlias(): string |
| 33 |
{ |
| 34 |
return $this->alias; |
| 35 |
} |
| 36 |
} |