Skip to content

Commit

Permalink
Merge pull request #21691 from colemanw/sqlExprTitles
Browse files Browse the repository at this point in the history
APIv4 - Give every SQL expression a title
  • Loading branch information
eileenmcnaughton authored Oct 2, 2021
2 parents 489e0ce + 4e16179 commit ed72890
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Civi/Api4/Query/SqlEquation.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,8 @@ public function formatOutputValue($value, &$dataType) {
return $value;
}

public static function getTitle(): string {
return ts('Equation');
}

}
5 changes: 5 additions & 0 deletions Civi/Api4/Query/SqlExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ public function getType(): string {
return substr($className, strrpos($className, '\\') + 1);
}

/**
* @return string
*/
abstract public static function getTitle(): string;

/**
* @return string|NULL
*/
Expand Down
4 changes: 4 additions & 0 deletions Civi/Api4/Query/SqlField.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ public function render(array $fieldList): string {
return $fieldList[$this->expr]['sql_name'];
}

public static function getTitle(): string {
return ts('Field');
}

}
5 changes: 0 additions & 5 deletions Civi/Api4/Query/SqlFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ public static function getCategory(): string {
return static::$category;
}

/**
* @return string
*/
abstract public static function getTitle(): string;

/**
* @return string
*/
Expand Down
4 changes: 4 additions & 0 deletions Civi/Api4/Query/SqlNull.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ public function render(array $fieldList): string {
return 'NULL';
}

public static function getTitle(): string {
return ts('Null');
}

}
4 changes: 4 additions & 0 deletions Civi/Api4/Query/SqlNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ public function render(array $fieldList): string {
return $this->expr;
}

public static function getTitle(): string {
return ts('Number');
}

}
4 changes: 4 additions & 0 deletions Civi/Api4/Query/SqlString.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ public function render(array $fieldList): string {
return '"' . \CRM_Core_DAO::escapeString($this->expr) . '"';
}

public static function getTitle(): string {
return ts('Text');
}

}
4 changes: 4 additions & 0 deletions Civi/Api4/Query/SqlWild.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ public function render(array $fieldList): string {
return '*';
}

public static function getTitle(): string {
return ts('Wild');
}

}

0 comments on commit ed72890

Please sign in to comment.