gabordemooij / redbean

ORM layer that creates models, config and database on the fly
https://www.redbeanphp.com
2.31k stars 279 forks source link

Make it possible to preload children #274

Closed F21 closed 11 years ago

F21 commented 11 years ago

Recently, I have been updating our code so that we can use all the neat and new features in RedBean to improve performance.

Is it possible for preloading of children using R::preload to be supported?

gabordemooij commented 11 years ago

Yes:

R::preload($book, array('ownPage'=>'page')); R::preload($book, array('sharedPage'=>'page'));

see: http://www.redbeanphp.com/eager_loading performance will be even better in the next release!

F21 commented 11 years ago

Looking forward to the performance enhancements! :smile: Will using the advanced syntax ('book,*.author,&.shelf') also support loading lists and aliases in the future?

gabordemooij commented 11 years ago

sorry for the confusion: aliases/lists are already possible:

from the unit tests:

R::preload($books,array('coauthor'=>'author')); R::preload($armies,array('sharedVillage'=>'village','sharedVillage.sharedPeople'=>'people'));

F21 commented 11 years ago

Awesome! Could you add these to the manual? It would be very useful! :smile:

Edit: Just saw that it was done. Closing. :)