Installation
composer require amstaffix/extjs-bundle
Ensure jms/serializer-bundle, doctrine/orm (or doctrine/mongodb-odm), and sensio/generator-bundle are installed.
Enable the Bundle
Add to AppKernel.php:
new AmsTaFFix\ExtJsBundle\AmsTaFFixExtJsBundle(),
Configure
Add to config.yml:
ams_taffix_extjs:
entities:
- AppBundle\Entity\YourEntity
rest_controller:
enabled: true
First Use Case Generate a REST controller for an entity:
php app/console generate:extjs:rest YourEntity
This creates a controller with CRUD endpoints (GET, POST, PUT, PATCH, DELETE) for your entity.
src/AmsTaFFix/ExtJsBundle/Resources/views/ for templates.config.yml under ams_taffix_extjs for entity mappings.@Serializer\ExclusionPolicy).Entity-to-ExtJS Model Mapping
The bundle auto-generates ExtJS Ext.data.Model configurations based on Doctrine entities. Example:
# config.yml
ams_taffix_extjs:
entities:
AppBundle\Entity\User:
model_name: 'UserModel'
fields:
- { name: 'id', type: 'int' }
- { name: 'username', type: 'string' }
config.yml or let the bundle infer them from Doctrine metadata.ExtJS Remoting Integration Use Symfony controllers as ExtJS remoting endpoints. Example:
// src/AppBundle/Controller/UserController.php
use AmsTaFFix\ExtJsBundle\Controller\ExtJsController;
class UserController extends ExtJsController
{
public function getUsersAction()
{
return $this->getEntityManager()->getRepository('AppBundle:User')->findAll();
}
@Route and ensure they match ExtJS proxy configurations:
// ExtJS Proxy Example
proxy: {
type: 'rest',
url: '/api/users',
reader: { type: 'json', root: 'data' }
}
REST Controller Generation Generate a full REST controller for an entity:
php app/console generate:extjs:rest User
getUsersAction(), postUserAction(), etc.Twig Integration Render ExtJS views with Twig:
{% render 'AmsTaFFixExtJsBundle:Default:index.html.twig' %}
{{ asset('bundles/amstaffixextjs/js/extjs.js') }} for ExtJS JS/CSS.Entity Changes → Update ExtJS Models
config.yml or entity annotations.php app/console cache:clear
API Development
generate:extjs:rest for boilerplate.Frontend Development
/api/users).Ext.data.Store with auto-generated model names (e.g., UserModel).Serializer Compatibility
@Serializer\ExclusionPolicy("ALL")).@Serializer\Expose() to properties you want to expose to ExtJS.Route Conflicts
routing.yml.ExtJS Version Mismatch
Resources/public/js/extjs.js for compatibility.Caching Issues
php app/console cache:clear --env=prod
FOSRestBundle Dependency
FOSRestBundle.composer require friendsofsymfony/rest-bundle
Check Generated Models
var/cache/dev/ams_taffix_extjs/models/ for auto-generated ExtJS model configs.Symfony Profiler
ExtJS Console
Ext.onReady(function() {
Ext.Loader.setConfig({ enabled: true, disableCaching: false });
});
Custom Model Templates
Resources/views/ExtJs/model.js.twig to your bundle.Partial Entity Mapping
config.yml:
fields:
- { name: 'id', type: 'int' }
- { name: 'username', type: 'string' }
- { name: 'password', type: 'string', exclude: true }
ExtJS Theming
API Versioning
api_platform or api route prefixes to version your ExtJS endpoints:
# config.yml
ams_taffix_extjs:
rest_controller:
route_prefix: 'api/v1'
Testing
$client = static::createClient();
$crawler = $client->request('GET', '/api/users');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
How can I help you explore Laravel packages today?