Skip to content

Commit

Permalink
custom scenarioDefaultDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
siggi-k committed Aug 25, 2024
1 parent 5c7fa9b commit ef1e59a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/lib/items/DbModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ class DbModel extends BaseObject
*/
private array $scenarios;

/**
* @var string
* Here, you can set your own default description for the scenario.
* You can use the {name} attribute from the schema for the YAML model.
*/
public string $scenarioDefaultDescription = " Scenario {name}";

public function getTableAlias():string
{
return '{{%' . $this->tableName . '}}';
Expand Down Expand Up @@ -227,9 +234,12 @@ private function getScenariosByOpenapiSchema(): array

foreach ($scenarios as $key => $scenario) {
$scenarios[$key]['const'] = 'SCENARIO_' . strtoupper($scenario['name']);
$scenarios[$key]['description'] = !empty($scenario['description']) ?
FormatHelper::getFormattedDescription($scenario['description'], 5)
: ' Scenario ' . $scenario['name'];
$scenarios[$key]['description'] = FormatHelper::getFormattedDescription(
!empty($scenario['description']) ?
$scenario['description']
: str_replace('{name}', $scenario['name'], $this->scenarioDefaultDescription
),
5);
}

return $scenarios;
Expand Down

0 comments on commit ef1e59a

Please sign in to comment.