diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..8ffc029b8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "web/api/app/Plugin/Crud"] + path = web/api/app/Plugin/Crud + url = git://github.com/FriendsOfCake/crud.git + branch = master diff --git a/web/api/app/Config/bootstrap.php b/web/api/app/Config/bootstrap.php index 56b28260f..3a0981dd3 100644 --- a/web/api/app/Config/bootstrap.php +++ b/web/api/app/Config/bootstrap.php @@ -69,7 +69,7 @@ Cache::config('default', array('engine' => 'File')); * CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit * */ - +CakePlugin::load('Crud'); /** * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters: * diff --git a/web/api/app/Controller/AppController.php b/web/api/app/Controller/AppController.php index a827969e1..160514054 100644 --- a/web/api/app/Controller/AppController.php +++ b/web/api/app/Controller/AppController.php @@ -18,8 +18,8 @@ * @since CakePHP(tm) v 0.2.9 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ - App::uses('Controller', 'Controller'); +App::uses('CrudControllerTrait', 'Crud.Lib'); /** * Application Controller @@ -31,4 +31,18 @@ App::uses('Controller', 'Controller'); * @link http://book.cakephp.org/2.0/en/controllers.html#the-app-controller */ class AppController extends Controller { + use CrudControllerTrait; + + public $components = [ + 'RequestHandler', + 'Crud.Crud' => [ + 'actions' => [ + 'index' => 'Crud.Index', + 'add' => 'Crud.Add', + 'edit' => 'Crud.Edit', + 'view' => 'Crud.View' + ], + 'listeners' => ['Api', 'ApiTransformation'] + ] + ]; } diff --git a/web/api/app/Plugin/Crud b/web/api/app/Plugin/Crud new file mode 160000 index 000000000..6faf8df67 --- /dev/null +++ b/web/api/app/Plugin/Crud @@ -0,0 +1 @@ +Subproject commit 6faf8df67fb788351e00e9401670558cad3dab05