Skip to content

Commit dd26da1

Browse files
committed
Merge branch 'master' into develop
2 parents 746cc5e + 3be60d4 commit dd26da1

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

.semver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
22
:major: 6
33
:minor: 0
4-
:patch: 0
4+
:patch: 1
55
:special: ''

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Changelog
44
Releases for CakePHP 3
55
-------------
66

7+
* 6.0.1
8+
* Fix deprecation messages
9+
710
* 1.0.0-beta.2
811
* Implements api middleware with PSR-7 support
912

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Versions and branches
1515

1616
| CakePHP | CakeDC Api Plugin | Tag | Notes |
1717
| :-------------: | :------------------------: | :--: | :---- |
18-
| ^3.6 | [master](https://github.com/cakedc/cakephp-api/tree/master) | 6.0.0 | stable |
18+
| ^3.6 | [master](https://github.com/cakedc/cakephp-api/tree/master) | 6.0.1 | stable |
1919
| ^3.6 | [develop](https://github.com/cakedc/cakephp-api/tree/develop) | - | unstable |
2020
| 3.5 | [5.x](https://github.com/cakedc/cakephp-api/tree/5.0.0) | 5.0.0 | stable |
2121
| 3.4 | [4.x](https://github.com/cakedc/cakephp-api/tree/4.0.0) | 4.0.0 | stable |
@@ -41,6 +41,6 @@ This repository follows the [CakeDC Plugin Standard](http://cakedc.com/plugin-st
4141
License
4242
-------
4343

44-
Copyright 2016 Cake Development Corporation (CakeDC). All rights reserved.
44+
Copyright 2016-2018 Cake Development Corporation (CakeDC). All rights reserved.
4545

4646
Licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.

config/api.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
// Data parse from cakephp request object
1919
'parser' => 'CakeDC/Api.Form',
2020

21+
//routes inflector: specify underscore, dasherize, or false for neither/no inflection
22+
'routesInflectorMethod' => false,
23+
2124
// version is not used
2225
'useVersioning' => false,
2326
'versionPrefix' => 'v',

src/Controller/ApiController.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use CakeDC\Api\Service\ConfigReader;
1515
use CakeDC\Api\Service\ServiceRegistry;
16+
use Cake\Core\Configure;
1617
use Cake\Utility\Inflector;
1718
use Exception;
1819

@@ -57,7 +58,7 @@ public function process()
5758
*/
5859
public function listing()
5960
{
60-
$this->request['service'] = 'listing';
61+
$this->request = $this->request->withParam('service', 'listing');
6162
$options = [
6263
'className' => 'CakeDC/Api.Listing'
6364
];
@@ -71,7 +72,7 @@ public function listing()
7172
*/
7273
public function describe()
7374
{
74-
$this->request['service'] = 'describe';
75+
$this->request = $this->request->withParam('service', 'describe');
7576
$options = [
7677
'className' => 'CakeDC/Api.Describe'
7778
];
@@ -86,13 +87,15 @@ public function describe()
8687
*/
8788
protected function _process($options = [])
8889
{
90+
$routesInflectorMethod = Configure::read('Api.routesInflectorMethod', 'underscore');
91+
8992
$this->autoRender = false;
9093
try {
91-
if (!empty($this->request['service'])) {
92-
$service = $this->request['service'];
94+
if (!empty($this->request->getParam('service'))) {
95+
$service = $this->request->getParam('service');
9396
$version = null;
94-
if (!empty($this->request['version'])) {
95-
$version = $this->request['version'];
97+
if (!empty($this->request->getParam('version'))) {
98+
$version = $this->request->getParam('version');
9699
}
97100

98101
$url = '/' . $service;
@@ -103,7 +106,7 @@ protected function _process($options = [])
103106
'version' => $version,
104107
'request' => $this->request,
105108
'response' => $this->response,
106-
'baseUrl' => Inflector::underscore($url),
109+
'baseUrl' => $routesInflectorMethod === false ? $url : Inflector::{$routesInflectorMethod}($url)
107110
];
108111
$options += (new ConfigReader())->serviceOptions($service, $version);
109112
$Service = ServiceRegistry::getServiceLocator()->get($service, $options);

0 commit comments

Comments
 (0)