From eb10a0f2e231bdabdfca2e9d65329cbe9ad5dedb Mon Sep 17 00:00:00 2001 From: Brian Kelleher Date: Mon, 7 Nov 2016 08:24:58 -0500 Subject: [PATCH] editorconfig, array syntax, comments --- .editorconfig | 9 +++++++++ api/index.php | 13 +++++++------ api/routes/category.php | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..422e619 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.php] +indent_style = tab +indent_size = 2 \ No newline at end of file diff --git a/api/index.php b/api/index.php index ddfba8e..ee8530e 100644 --- a/api/index.php +++ b/api/index.php @@ -1,16 +1,17 @@ add('', __DIR__ . '/generated-classes/'); -require './generated-conf/config.php'; +$autoloader = require './vendor/autoload.php'; // Composer Autoload Libraries +$autoloader->add('', __DIR__ . '/generated-classes/'); // Propel ORM Classes +require './generated-conf/config.php'; // Propel Config +require './config.php'; // Slim Config -$app = new \Slim\App(); +// Init Slim +$app = new \Slim\App($config); /** * Routes */ require './routes/category.php'; +// Run App $app->run(); \ No newline at end of file diff --git a/api/routes/category.php b/api/routes/category.php index 2666f1a..d53bf11 100644 --- a/api/routes/category.php +++ b/api/routes/category.php @@ -11,10 +11,10 @@ $app->get('/category/all', function( $request, $response ) { "data" => [] ]; foreach( $cats as $cat ) { - $response_json["data"][] = array( + $response_json["data"][] = [ "id" => $cat->getId(), "name" => $cat->getName() - ); + ]; } $response = $response->withJSON($response_json); return $response;