/**
  * Preloads certain properties for beans.
  * Understands aliases.
  *
  * Usage:
  *
  * $db->preload($books, 'author');
  *
  * - preloads all the authors of all books,
  * saves you a query per for-each iteration
  *
  * $db->preload($books, array('coauthor'=>'author'));
  *
  * - same but with alias
  *
  * $db->preload($texts,'page,page.book,page.book.author');
  *
  * - preloads all pages for the texts, the books and the authors
  *
  * $db->preload($texts,'page,*.book,*.author');
  *
  * - same as above bit with short syntax (* means prefix with previous types)
  *
  * $db->preload($p,'book,*.author,&.shelf');
  *
  * - if author and shelf are on the same level use & instead of *.
  *
  * The other way around is possible as well, to load child beans in own-lists or
  * shared-lists use:
  *
  * $db->preload($books,'ownPage|page,sharedGenre|genre');
  *
  * @param array        $beans beans beans to use as a reference for preloading
  * @param array|string $types types to load, either string or array
  *
  * @return array
  */
 public function preload($beans, $types, $closure = NULL)
 {
     return $this->redbean->preload($beans, $types, $closure);
 }
Example #2
0
 /**
  * Preloads certain properties for beans.
  * Understands aliases.
  *
  * Usage: 
  * 
  * R::preload($books, 'author');
  * 
  * - preloads all the authors of all books, 
  * saves you a query per for-each iteration
  * 
  * R::preload($books, array('coauthor'=>'author'));
  * 
  * - same but with alias
  * 
  * R::preload($texts,'page,page.book,page.book.author');
  * 
  * - preloads all pages for the texts, the books and the authors
  * 
  * R::preload($texts,'page,*.book,*.author');
  * 
  * - same as above bit with short syntax (* means prefix with previous types)
  *
  * R::preload($p,'book,*.author,&.shelf');
  * 
  * - if author and shelf are on the same level use & instead of *.
  * 
  * The other way around is possible as well, to load child beans in own-lists or
  * shared-lists use:
  * 
  * R::preload($books,'ownPage|page,sharedGenre|genre');
  * 
  * @param array        $beans beans beans to use as a reference for preloading
  * @param array|string $types types to load, either string or array
  *
  * @return array
  */
 public static function preload($beans, $types, $closure = NULL)
 {
     return self::$redbean->preload($beans, $types, $closure);
 }
 /**
  * Preloads certain properties for beans.
  * Understands aliases.
  * 
  * Usage: R::preload($books,array('coauthor'=>'author'));
  * 
  * @param array $beans beans
  * @param array $types types to load
  */
 public static function preload($beans, $types)
 {
     return self::$redbean->preload($beans, $types);
 }