Zend Frame Work 1.12 / Doctrine 2 Techy Question

logicfusion

Free Member
Jul 2, 2009
519
54
Sheffield
Hi

Its been a while since I dabbled with Zend, but I have recently picked it up again. I know a few Zend Framework gurus frequent these forums!

I've set up ZF 1 with Doctrine 2 (using Guilherme Blanco as the glue to hold it all together).

The MVC pattern suggests using 'thin controllers' and 'fat models'.

Where are you supposed to place your business logic with a ZF1 and Doctrine 2 setup?

Placing the logic in the Doctrine 2 Entities or extending them does not seem correct.

A ZF presentation suggests that the business logic should be placed in a service layer. Does anyone know any decent examples showing how this can be done with Doctrine 2?

I'm kind unclear of the difference between models and services in Zend. Do you create models (with your core business logic) and then link these somehow to services (for accessing the Doctrine 2 entities)?

Or do you perhaps consider the stack - ORM mapper, entities, service layer collectively as a model itself?

Cheers
Al
 

logicfusion

Free Member
Jul 2, 2009
519
54
Sheffield
I am curious why you are doing it this way?

Do you mean integrating with Doctrine 2? If so, mainly from a fair amount of reading which indicates this isn't a bad choice. I've had a play with Doctrine 2 and its pretty powerful from what I've seen. My schema is relatively complex and I appreciate the automated mapping Doctrine does.

On the other had, I can see that I am potentially introducing a layer of complexity into my app.


Also why use ZF1 when ZF2 has been out for a while

Mainly because I have several books on ZF1 and none on ZF2.
It is my intention to move over to ZF2 at some point, but given I've invested a fair amount of time on the former...

I'm guessing you have made the transition. :)


And if you want to use Doctrine, why not use Symfony2?
To be honest, I've never really looked at Symfony2.
 
Upvote 0

edmondscommerce

Free Member
Nov 11, 2008
3,653
628
UK
If you like Doctrine then you should definitely check out Symfony2. I'm using it at the moment on a project and loving it to be honest, definitely recommend you check it out.

On the complex schema Doctrine thing though - the automated entity generation will only take you so far, you do need to do some actual work to get it all the way, leave that out and you are going to have a bad time!
 
Upvote 0

logicfusion

Free Member
Jul 2, 2009
519
54
Sheffield
If you like Doctrine then you should definitely check out Symfony2. I'm using it at the moment on a project and loving it to be honest, definitely recommend you check it out.

I will definitely check that out.
I do love the routing in Zend; ie it is pretty easy to set up user accounts on a subdomain in addition to static routes that go via the main domain. There seems to be endless possibilities!


On the complex schema Doctrine thing though - the automated entity generation will only take you so far, you do need to do some actual work to get it all the way, leave that out and you are going to have a bad time!
There is only so far I would trust it :) I still think it is pretty clever to be able to work out some of the easier table joins / dependencies.
 
Last edited:
Upvote 0

Latest Articles