Skip to content

Commit

Permalink
Merge commit '1dbc6ede1e69d0a1d5064f8826fa2f2961d93b23' into feature/…
Browse files Browse the repository at this point in the history
…gabo

# Conflicts:
#	src/generators/crud/default/views/view.php - FIXED -
  • Loading branch information
eluhr committed Jan 24, 2022
2 parents d2a659f + 1dbc6ed commit 1def178
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog

- do not use auto-pluralization in views, pluralize via I18N
- Improved model generation performance (see`modelCacheRelationsData`)
- updated php-cs-fixer to version 3

### 0.13.0

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dmstr/yii2-bootstrap": "^0.1.2 || ^0.2.1",
"dmstr/yii2-helpers": "*",
"dmstr/yii2-db": "*",
"friendsofphp/php-cs-fixer": "1.* || 2.*",
"friendsofphp/php-cs-fixer": "1.* || 2.* || 3.*",
"yiisoft/yii2": "~2.0.13",
"yiisoft/yii2-gii": "^2.2.0"
},
Expand Down
7 changes: 6 additions & 1 deletion src/commands/BatchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ class BatchController extends Controller

public $crudActionButtonColumnPosition = 'left';

/**
* @var string Class name of the model generator
*/
public $modelGeneratorClass = 'schmunk42\giiant\generators\model\Generator';

/**
* @var bool indicates whether to generate ActiveQuery for the ActiveRecord class
*/
Expand Down Expand Up @@ -390,7 +395,7 @@ public function beforeAction($action)
{
$this->appConfig = $this->getYiiConfiguration();
$this->appConfig['id'] = 'temp';
$this->modelGenerator = new ModelGenerator(['db' => $this->modelDb]);
$this->modelGenerator = Yii::createObject($this->modelGeneratorClass, ['db' => $this->modelDb]);

if ($this->tables && $this->skipTables) {
$this->stderr("Only one property of 'tables' or 'skipTables' can be set." . PHP_EOL);
Expand Down
6 changes: 3 additions & 3 deletions src/generators/crud/default/views/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
*/
$copyParams = $model->attributes;

$this->title = <?= $generator->generateString($modelName) ?>;
$this->params['breadcrumbs'][] = ['label' => <?= $generator->generateString($modelName) ?>, 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => (string)$model-><?= $generator->getNameAttribute() ?>, 'url' => ['view', <?= $urlParams ?>]];
$this->title = Yii::t('<?= $generator->modelMessageCategory ?>', '<?= $modelName ?>');
$this->params['breadcrumbs'][] = ['label' => Yii::t('<?= $generator->modelMessageCategory ?>.plural', '<?= $modelName ?>'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => (string)$model-><?= $generator->getModelNameAttribute($model)?>, 'url' => ['view', <?= $urlParams ?>]];
$this->params['breadcrumbs'][] = <?= $generator->generateString('View') ?>;
?>
<div class="giiant-crud <?= Inflector::camel2id(StringHelper::basename($generator->modelClass), '-', true) ?>-view">
Expand Down

0 comments on commit 1def178

Please sign in to comment.