Skip to content

Commit 7799c8e

Browse files
committed
Fix issue in generated url rule config
1 parent 221f8ac commit 7799c8e

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/generator/default/urls.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
<?php
2+
3+
use yii\helpers\VarDumper;
4+
5+
?>
16
<?= '<?php' ?>
27

38
/**
49
* OpenAPI UrlRules
510
*
611
* This file is auto generated.
712
*/
8-
<?php $rules = \yii\helpers\VarDumper::export($urls);?>
13+
<?php /** @var array $urls */
14+
$rules = VarDumper::export($urls); ?>
915
return <?= str_replace('\\\\', '\\', $rules); ?>;

src/lib/generators/RestActionGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ protected function prepareAction(string $method, Operation $operation, RouteData
109109
} else {
110110
$controllerId = $routeData->controller;
111111
}
112-
$action = ucfirst($routeData->action);
112+
$action = Inflector::camel2id($routeData->action);
113113
return Yii::createObject(RestAction::class, [
114114
[
115-
'id' => trim("$actionType$action", '-'),
115+
'id' => trim("$actionType-$action", '-'),
116116
'controllerId' => $controllerId,
117117
'urlPath' => $routeData->path,
118118
'requestMethod' => strtoupper($method),

src/lib/items/RestAction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public function getRoute():string
7272
{
7373
if ($this->prefix && !empty($this->prefixSettings)) {
7474
$prefix = $this->prefixSettings['module'] ?? $this->prefix;
75-
return trim($prefix, '/').'/'.$this->controllerId.'/'.$this->id;
75+
return trim($prefix, '/') . '/' . $this->controllerId . '/' . $this->id;
7676
}
77-
return $this->controllerId.'/'.$this->id;
77+
return $this->controllerId . '/' . $this->id;
7878
}
7979

8080
public function getOptionsRoute():string

0 commit comments

Comments
 (0)