DAO layer with two tables

0

My question when working with the DAO layer follows the following:

As far as I know, each table would refer to a DAO object. But suppose it is necessary to query with select / JOIN , that is, it returns data from more than one table in a single query.

In this case, could the% object of% of one table fetch data from another table?

    
asked by anonymous 03.06.2015 / 16:33

1 answer

2

Keep it simple, it's the best thing for future maintenance of an application!

If you need to make a join with another table, choose where DAO makes the most sense to make this relationship.

For example, I have a classe called ClientDAO and the other call AddressDAO , and I want to relate the client to its addresses, which may be several, it will make no sense to make this relationship in class ClientDAO , because who does the abstraction of addresses and AddressDAO .

So just pass the properties of the Client layer to AddressDAO .

related(Client $Client)
    
07.06.2015 / 05:42