Thank you, Peter, that's a link I've never found before, although looking into the documentation of Zend_Db_Table should be obvious, my bad.
Time to dive into the docs =)

Galvao
http://www.galvao.eti.br/

Peter Warnock wrote:
http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.fetching.dependent

On Sat, Sep 12, 2009 at 6:31 PM, Er Galvao Abbott <[email protected]> wrote:
Greetings.

I have this basic question for quite some time now and it's incredibly hard to find examples that explain this. I guess it's pretty self explanatory, but here we go:

If I need to gather data from a database table I create a model, a data gateway and a mapper, and then I just use a method like fetchAll which executes the desired query ('select foo from bar' or something like that).

My question is, what if I need to gather data from multiple tables? Let's say I have a users table and a group table. If I need to get details from a user I'd use a method such as find from the user data gateway, but what if I need to pull data from the user and group tables? You know, something like:

SELECT u.email, g.name FROM users u, groups g WHERE u.group_id = g.id

Of course, I could just "cheat" and create a method in the user data gateway which retrieves everything, but since I'm retrieving data from a table other than the user's wouldn't that be wrong?
Hope I've made myself clear.

Cheers,

Galvao
http://www.galvao.eti.br/


Reply via email to