Hi Koen,

I just published a chapter on implementing the Model you may want to look into 
to see how it fits. The book is free to read ;).
http://www.survivethedeepend.com/zendframeworkbook/en/1.0/implementing.the.domain.model.entries.and.authors

I think the main point I think is that you are thinking in terms of the 
database. Why use a join? You can use two distinct SQL queries and then 
aggregate these as objects. In the book, I used a simple example of blog 
entries needing authors - so the entry object contains an author object.

Joins are great, no mistake, but they are also premature optimisation. You can 
offset the cost of two queries using caching and lazy loading to avoid database 
access in the first place.

Hope this helps!

 Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation Irish Representative





________________________________
From: Koen <[email protected]>
To: [email protected]
Sent: Friday, August 21, 2009 11:36:35 AM
Subject: [fw-general] Question regarding models

I've been looking at the new Quick Start in the ZF manual, particularly the 
model part. For a new project I'm trying to create my models in the same way 
(including a data mapper, etc). 

Unfortunately I don't know how to handle the relationships. When requesting 
data from your model you often want to include some fields in related tables 
(using joins), but I don't see a way doing that using the pattern as described 
in the quick start guide. Can someone give me some tips regarding this?

Thanks in advance!

Reply via email to