From 3d28c44fdee571d26e230e69fc5bbdc2e60eb7e0 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Mon, 3 Dec 2018 17:52:22 -0500 Subject: [PATCH] fix deprecations change default statusCode to 200 --- config/bootstrap.php | 8 -------- config/routes.php | 8 +------- src/Application.php | 15 +++++++++++++-- src/Controller/AppController.php | 2 +- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/config/bootstrap.php b/config/bootstrap.php index 938d3c2..f49adcf 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -213,13 +213,5 @@ Type::build('timestamp') * */ -/* - * Only try to load DebugKit in development mode - * Debug Kit should not be installed on a production system - */ -if (Configure::read('debug')) { - Plugin::load('DebugKit', ['bootstrap' => true]); -} - Configure::load('lbry'); diff --git a/config/routes.php b/config/routes.php index abb4474..6a06462 100644 --- a/config/routes.php +++ b/config/routes.php @@ -71,10 +71,4 @@ Router::scope('/', function (RouteBuilder $routes) { $routes->connect('/api/v1/claims/browse', ['controller' => 'Claims', 'action' => 'apibrowse']); //$routes->fallbacks(DashedRoute::class); -}); - -/** - * Load all plugin routes. See the Plugin documentation on - * how to customize the loading of plugin routes. - */ -Plugin::routes(); +}); \ No newline at end of file diff --git a/src/Application.php b/src/Application.php index 9c5999b..7245290 100644 --- a/src/Application.php +++ b/src/Application.php @@ -12,6 +12,7 @@ * @since 3.3.0 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ + namespace App; use Cake\Core\Configure; @@ -40,13 +41,23 @@ class Application extends BaseApplication // Catch any exceptions in the lower layers, // and make an error page/response ->add(ErrorHandlerMiddleware::class) - // Handle plugin/theme assets like CakePHP normally does. ->add(AssetMiddleware::class) - // Apply routing ->add(RoutingMiddleware::class); return $middleware; } + + public function bootstrap() + { + parent::bootstrap(); // TODO: Change the autogenerated stub + /* + * Only try to load DebugKit in development mode + * Debug Kit should not be installed on a production system + */ + if (Configure::read('debug')) { + $this->addPlugin(\DebugKit\Plugin::class); + } + } } diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php index 06b9208..591c8f4 100644 --- a/src/Controller/AppController.php +++ b/src/Controller/AppController.php @@ -68,7 +68,7 @@ class AppController extends Controller } } - protected function _jsonResponse($object = [], $statusCode = null) + protected function _jsonResponse($object = [], $statusCode = 200) { $this->response->withStatus($statusCode); $this->response->withType('json');