View Full Version : Ext.Direct and ORM

25 Jan 2010, 3:31 AM

I used to use stores the old-way, just with store.load() and doing the commit stuffs an handy way, and do I'd like to test the Ext.Direct API.

I was wondering how to associate Ext.Direct and an ORM. I think it's the principal purpose of Ext.Direct to be associated with an ORM to do all the CRUD job and I was looking for some advices, best practices or anything else.
For the moment I'm going to use PHP and maybe Doctrine as ORM.

Thanks for your help

25 Jan 2010, 10:32 AM
This is just my opinion of course but to a large extent, Ext.Direct eliminates the need for an ORM. With Ext.Direct you end up writing one server side method for each CRUD operation (create/update/delete). I just write the necessary sql and update the database directly.

There is really not much value in going through an ORM and of course it will add a great deal of overhead.

3 Feb 2010, 2:56 AM
I'd want to code a simple grid using ext.direct and I'm a bit confused...
I don't really know how to start... I'm used to JSON-RPC with a PHP backend and it's really simple for me.

I searched for a full example in the forum or somewhere else, on wich I could base my code and which would help me to understand the mechanism of Ext.Direct but in vain...

I think I understood that it was in the store configuration I had to put the link to the Ext.Direct stuff like this :

new Ext.data.DirectStore({
api: {
create: AppDirect.Tst.create,
read: AppDirect.Tst.read,
update: AppDirect.Tst.update,
destroy: AppDirect.Tst.destroy
writer: new Ext.data.JsonWriter({
encode: false,
writeAllFields: false
autoSave: true,
reader: new Ext.data.JsonReader({
{name: 'id_ref_pl', type: 'int'}
,{name: 'package', type: 'string'}
,{name: 'objet', type: 'string'}
,{name: 'type', type: 'string'}
,sortInfo:{field: 'objet', direction: "ASC"}


But I don't know what to do after... I have some ideas... I think I have to use a "PHP stack" (TommyMaintz one for example) and implement the api functions I want to use (in my case some CRUD stuff)...

If someone could direct me a little :D

After that I will write a full tutorial for all ext.direct newbies as me ;)

3 Feb 2010, 10:35 AM
Start by reading this:

If you still have questions then post them.

Your api approach is correct. You just need to link the functions to server classes/methods.

4 Feb 2010, 1:13 AM
I worked a little bit yesterday evening and finally succeed in accessing my Ext.Direct backend.
I will continue further and next I will write a tutorial.

4 Feb 2010, 8:46 AM
I worked a little bit yesterday evening and finally succeed in accessing my Ext.Direct backend.
I will continue further and next I will write a tutorial.
I'll be glad to review the tutorial when you have it ready. Thought about writing one myself but too lazy.

4 Feb 2010, 12:37 PM
Before writing it I want to have a full working grid with CRUD, filter and remote sorting.

For now, I have nothing in the data parameter posted to the backend :-/

Here is my store :

store: new Ext.data.DirectStore({
paramsAsHash: false

,api: {
// create: Test.create,
read: Test.read//,
//update: Sh.update,
//destroy: Sh.destroy
,reader: new Ext.data.JsonReader({
root: 'root'
,fields: this.fields
,writer: new Ext.data.JsonWriter({ encode: false })

,sortInfo:{field: 'zipcode', direction: "ASC"}


and my api :

'Test' => array(

4 Feb 2010, 1:32 PM
My remote sorting is ok.
I'm validating the paging...

DO you think it's possible to use the ux.grid.filter with Ext.Direct?

4 Feb 2010, 2:16 PM
Glad your sorting is working. I just use paramsHash and keep len = 1

All the parameters end up in one array, easy to pull apart on the server


4 Feb 2010, 3:51 PM
Now I have :

TODO : Create

and fix the filter (I don't know why at first load the baseParams is not sent to the server).

So, it's time to sleep now! :D

4 Feb 2010, 4:03 PM
I posted a simple example of creating a record at the end of this thread.