I have models Message
and File
. Message can have a lot of files (attachments).
I need to do something like:
new Select('message')->join('file', 'file.message_id = message.id', array('url'), 'left')
but I want to get Message
array where every message has a property files
with an array of File
. How to do something like this in zf2?
Zf2 does not implement any ORM from the beginning, it's using Gateway pattern, you give it a request, it returns a ResultSet which is iterable, and return a ResultSetPrototype (object) or an Array for each row in the ResultSet.
If you want an ORM, you'll have to build it or use one like Doctrine 2 (which has an implementation on Zf2)
resources :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.