From 5747a663e3ea9386fa212e69c582988b24381fda Mon Sep 17 00:00:00 2001 From: feuzeu Date: Sun, 30 Apr 2017 18:09:19 -0400 Subject: [PATCH] Now using classes provided by the jaxon-sentry package. --- README.md | 29 +++++++++++++++++------------ app/config/jaxon.yml | 4 ++-- composer.json | 2 +- src/Jaxon.php | 12 +++++++----- src/View.php | 4 ++-- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index f43beeb..195431a 100644 --- a/README.md +++ b/README.md @@ -52,12 +52,21 @@ The options in the `lib` section are those of the Jaxon core library, while the The following options can be defined in the `app` section of the config file. +| Name | Description | +|------|---------------| +| classes | An array of directory containing Jaxon application classes | +| views | An array of directory containing Jaxon application views | +| | | | + +By default, the `views` array is empty. Views are rendered from the framework default location. +There's a single entry in the `classes` array with the following values. + | Name | Default value | Description | |------|---------------|-------------| -| controllers.directory | jaxon/Controller | The directory of the Jaxon classes | -| controllers.namespace | \Jaxon\App | The namespace of the Jaxon classes | -| controllers.separator | . | The separator in Jaxon class names | -| controllers.protected | empty array | Prevent Jaxon from exporting some methods | +| directory | jaxon/Classes | The directory of the Jaxon classes | +| namespace | \Jaxon\App | The namespace of the Jaxon classes | +| separator | . | The separator in Jaxon class names | +| protected | empty array | Prevent Jaxon from exporting some methods | | | | | Usage @@ -93,19 +102,15 @@ Then it calls the `$jaxon->css()`, `$jaxon->js()` and `$jaxon->script()` functio ### The Jaxon classes -The Jaxon classes must inherit from `\Jaxon\Module\Controller`. - -The Jaxon classes of the application must all be located in the directory indicated by the `app.controllers.directory` option in the `jaxon.yml` config file. -If there is a namespace associated, the `app.controllers.namespace` option should be set accordingly. - -By default, the Jaxon classes are located in the `jaxon/Controller` dir of the Symfony application, and the associated namespace is `\Jaxon\App`. +The Jaxon classes must inherit from `\Jaxon\Sentry\Classes\Base`. +By default, they are located in the `jaxon/Classes` dir of the Symfony application, and the associated namespace is `\Jaxon\App`. -This is a simple example of a Jaxon class, defined in the `jaxon/Controller/HelloWorld.php` file. +This is a simple example of a Jaxon class, defined in the `jaxon/Classes/HelloWorld.php` file. ```php namespace Jaxon\App; -class HelloWorld extends \Jaxon\Module\Controller +class HelloWorld extends \Jaxon\Sentry\Classes\Base { public function sayHello() { diff --git a/app/config/jaxon.yml b/app/config/jaxon.yml index f57d7df..4f9abfc 100644 --- a/app/config/jaxon.yml +++ b/app/config/jaxon.yml @@ -1,9 +1,9 @@ parameters: jaxon: app: - controllers: + classes: - - directory: '%kernel.root_dir%/../jaxon/Controller' + directory: '%kernel.root_dir%/../jaxon/Classes' namespace: \Jaxon\App # separator: '' # '.' or '_' # protected: [] diff --git a/composer.json b/composer.json index 02142be..c6a90ce 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "source": "https://github.com/jaxon-php/jaxon-symfony" }, "require": { - "jaxon-php/jaxon-core": "~2.0", + "jaxon-php/jaxon-sentry": "~2.0", "symfony/symfony": "2.8.*|3.0.*|3.1.*" }, "autoload": { diff --git a/src/Jaxon.php b/src/Jaxon.php index 8e0d65f..23fd51f 100644 --- a/src/Jaxon.php +++ b/src/Jaxon.php @@ -8,7 +8,7 @@ class Jaxon { - use \Jaxon\Module\Traits\Module; + use \Jaxon\Sentry\Traits\Armada; /** * The application debug option @@ -57,26 +57,28 @@ protected function jaxonSetup() // The application web dir $baseDir = $_SERVER['DOCUMENT_ROOT']; + $sentry = jaxon()->sentry(); + // Set the config options jaxon()->setOptions($this->configs, 'lib'); $this->appConfig = new Config(); $this->appConfig->setOptions($this->configs, 'app'); // Jaxon library default settings - $this->setLibraryOptions(!$this->debug, !$this->debug, $baseUrl . '/jaxon/js', $baseDir . '/jaxon/js'); + $sentry->setLibraryOptions(!$this->debug, !$this->debug, $baseUrl . '/jaxon/js', $baseDir . '/jaxon/js'); // Set the default view namespace - $this->addViewNamespace('default', '', '.html.twig', 'twig'); + $sentry->addViewNamespace('default', '', '.html.twig', 'twig'); $this->appConfig->setOption('options.views.default', 'default'); // Add the view renderer $template = $this->template; - $this->addViewRenderer('twig', function() use($template) { + $sentry->addViewRenderer('twig', function() use($template) { return new View($template); }); // Set the session manager - $this->setSessionManager(function(){ + $sentry->setSessionManager(function(){ return new Session(); }); } diff --git a/src/View.php b/src/View.php index 9305895..9cfdd5f 100644 --- a/src/View.php +++ b/src/View.php @@ -2,8 +2,8 @@ namespace Jaxon\AjaxBundle; -use Jaxon\Module\View\Store; -use Jaxon\Module\Interfaces\View as ViewInterface; +use Jaxon\Sentry\View\Store; +use Jaxon\Sentry\Interfaces\View as ViewInterface; class View implements ViewInterface {