Merge pull request #19209 from mattwire/daoeventid
[civicrm-core.git] / Civi / Api4 / Query / SqlField.php
index 712bd7b8cc69bd6da8138f8f8a1b0e34264e4256..b6f69f4d5fb0744df03265abd522fa3b9c1796b5 100644 (file)
@@ -16,7 +16,12 @@ namespace Civi\Api4\Query;
  */
 class SqlField extends SqlExpression {
 
+  public $supportsExpansion = TRUE;
+
   protected function initialize() {
+    if ($this->alias && $this->alias !== $this->expr) {
+      throw new \API_Exception("Aliasing field names is not allowed, only expressions can have an alias.");
+    }
     $this->fields[] = $this->expr;
   }