summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/orm/src/AliasedExpression.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ipl/orm/src/AliasedExpression.php')
-rw-r--r--vendor/ipl/orm/src/AliasedExpression.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/ipl/orm/src/AliasedExpression.php b/vendor/ipl/orm/src/AliasedExpression.php
new file mode 100644
index 0000000..ed733a2
--- /dev/null
+++ b/vendor/ipl/orm/src/AliasedExpression.php
@@ -0,0 +1,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;
+ }
+}