Ember with Zend


#1

Hi all, has anyone attempted to create an ember app within zend? I’m having a hard time trying to visualize how the organization would be handled.

My gut instinct is that zend should be responsible for API, layout, and providing views, but that ember should be in charge of retrieving, displaying, and persisting that info through zend’s api onto the views that zend has provided .

The majority of the business logic would be within ember’s controllers and the like, with a little logic in zend’s controllers to expose data via the api.

Thoughts?

Added note: A colleague of mine has proposed a slightly different system in which data is front loaded and displayed with zend and then further operations (edit, delete, and the like) are done through ember, but I’m not convinced.


#2

I’m a Zend Framework 2 user, it does not change anything. Yes, your ZF app is responsible for the API, providing services, repositories to save to Db…

What I do in an EmberJS app is that all actions simply return the same HTML content (a very basic layout with a div id=“application” that will be filled by EmberJS.

But yes, you can do a hybrid approach, so for instance the first request, the whole view is generated server-side, and subsequent requests just communicate to your ZF app through the API, but this is much more work (because you need to maintain two templates, one server side and one client side).


#3

Who takes care of routing in your apps? Zend or ember? Or do you break routing up on a per page basis, routing big changes with zend + partials with ember?

edit: Thank you for the reply though, good to hear I’m not alone in that thought process.


#4

Routing is taking care by Ember, but your ZF app must be able to respond to the requests of course. You can either create a catch-all route that will return the same HTML layout for all requests, or just have a 1-to-1 matching between your Ember routes and Zend route.

EDIT : but really, this is not specific to Zend.