Your opinion on this architecture ? |
[eluser]Unknown[/eluser]
Hello everybody, I discover CI and try to start with good practices. I have an on-line application that send JSON requests on my CI server. There is different kind of request : A/ getDataFromBDD B/ getSingleLineFromBDD C/ updateLineInBDD D/ createNewLineInBDD I have thought this architecture to do the job : 1/ Only one controller (then called THE_CONTROLLER) that receives JSON requests, analyses the requests, checks that the user is registered and sessioned. 2/ Others controllers that are made to handle A,B,C or D kind of request. 3/ THE_CONTROLLER validates access and asks the accurate other controller to do the job for him 4/ THE_CONTROLLER gets returned array as result 5/ THE_CONTROLLER passes the array to a view that json_encode the result 6/ THE_CONTROLLER adapts response header to be wright understood by the browser Regarding that architecture I want to know 3 things : --> How can I make a controller ask an other controller to do the job ? --> Would IT be better to ask models rather than controller to do the job (even if calculation is complex and not only a resource solicitations) ? Keep in mind that I am not an MVC pro. --> What do you think about this architecture ? Thanks for your help PS : I profit of this post to send my felicitation for that powerful framework ! PS2 : Sorry for bad ways to say things, I am not a native English speaker. K.
[eluser]n0xie[/eluser]
What you are looking for is probably Presentation-abstraction-control also called Hierarchical-Model-View-Controller, Wiredesignz made a very good extension on the CI framework which you can find here. Now you can have 1 entry Controller which analyses the request then dispatches it to another controller which will generate some data which you then send back as a response. |
Welcome Guest, Not a member yet? Register Sign In |