-
Notifications
You must be signed in to change notification settings - Fork 14
Configuration Direct
Configuring the Direct API can be done by adding information to the kjsencha array inside your module.config.php
An example configuration which adds classes who will be generated by the Direct API generator would look like this:
<?php
return array(
'kjsencha' => array(
'direct' => array(
'cache' => false,
'modules' => array(
'Application' => array(
'namespace' => 'Application\Ajax\Direct',
'directory' => __DIR__ . '/../src/Application/Ajax/Direct',
),
),
),
'bootstrap' => array(
'default' => array(
'modules' => array(
'Application' => array(
'namespace' => 'Application.direct'
),
),
'paths' => array(
'Ext.ux' => 'assets/js/Ext.ux'
),
'requires' => array(
'Application.view.Viewport',
),
),
),
)
);The configuration holds quite some information which will be explained in the following examples.
'direct' => array(
'cache' => false,
'modules' => array(
'Application' => array(
'namespace' => 'Application\Ajax\Direct',
'directory' => __DIR__ . '/../src/Application/Ajax/Direct',
),
),
);-
cache Generating the API may take a while depending on the size of your folders, turning on caching in production will lower response time. Take note that caching is not recommended in development because it does not automatically refresh any changes in your classes or annotations.
-
modules contains a list with your modules and information where your Direct classes are stored.
namespacemust be the namespace that holds your Direct classes, for example if you have a classed namedApplication\Direct\CustomerandApplication\Direct\Orderthen the root namespace would beApplication\Directdirectoryis the folder that contains the classes, the API generator will look inside these folders to scrape your classes.
'bootstrap' => array(
'default' => array(
'modules' => array(
'Application' => array(
'namespace' => 'Application.direct'
),
),
'paths' => array(
'Ext.ux' => 'assets/js/Ext.ux'
),
'requires' => array(
'Application.view.Viewport',
),
),
),The bootstrap combines configuration and outputs this to javascript in order to setup any RemotingProviders or other information that you need.
In the current version there is only a default bootstrap, later this will be expanded so you
can use different bootstraps if you happen to have multiple different ExtJS applications
inside your Zend project.
-
modules Define the modules that you want to be included in the bootstrap, the
namespacewill be the variable in javascript which holds the Direct functions. -
paths Define Ext.loader.paths, if the path has no leading slash then the basePath will be prepended.
-
requires Any classes that you would like to be included through
Ext.requireon page load.