Merge pull request #19030 from civicrm/5.32
[civicrm-core.git] / Civi / Api4 / Query / SqlExpression.php
index e21f3880f4fb72d601ef070a24d7936b1b391dff..bce3d47144da3938a007f248ec7e7267891f07bc 100644 (file)
@@ -35,7 +35,15 @@ abstract class SqlExpression {
    * The raw expression, minus the alias.
    * @var string
    */
-  protected $expr = '';
+  public $expr = '';
+
+  /**
+   * Whether or not pseudoconstant suffixes should be evaluated during output.
+   *
+   * @var bool
+   * @see \Civi\Api4\Utils\FormattingUtil::formatOutputValues
+   */
+  public $supportsExpansion = FALSE;
 
   /**
    * SqlFunction constructor.
@@ -148,4 +156,14 @@ abstract class SqlExpression {
     return $this->alias ?? $this->fields[0] ?? \CRM_Utils_String::munge($this->expr);
   }
 
+  /**
+   * Returns the name of this sql expression class.
+   *
+   * @return string
+   */
+  public function getType(): string {
+    $className = get_class($this);
+    return substr($className, strrpos($className, '\\') + 1);
+  }
+
 }