/**
  * Preloads the shared beans.
  *
  * @param string $type     type of beans to load
  * @param string $sql      additional SQL snippet for loading
  * @param array  $bindings parameter bindings for SQL snippet
  * @param string $field    field to store preloaded beans in
  *
  * @return void
  */
 private function preloadSharedBeans($type, $sql, $bindings, $field)
 {
     $sharedBeans = $this->assocManager->relatedSimple($this->filteredBeans, $type, $sql, $bindings);
     // Let the filtered beans gather their beans
     foreach ($this->filteredBeans as $filteredBean) {
         $list = $this->gatherSharedBeansFromPool($filteredBean, $sharedBeans);
         $filteredBean->setProperty($field, $list, TRUE, TRUE);
         $this->fillParamArrayRetrievals($filteredBean, $list);
     }
 }
示例#2
0
 /**
  * Returns all the beans associated with $bean.
  * This method will return an array containing all the beans that have
  * been associated once with the associate() function and are still
  * associated with the bean specified. The type parameter indicates the
  * type of beans you are looking for. You can also pass some extra SQL and
  * values for that SQL to filter your results after fetching the
  * related beans.
  *
  * Don't try to make use of subqueries, a subquery using IN() seems to
  * be slower than two queries!
  *
  * Since 3.2, you can now also pass an array of beans instead just one
  * bean as the first parameter.
  *
  * @param RedBean_OODBBean|array $bean     the bean you have, the reference bean
  * @param string                 $type     the type of beans you want to search for
  * @param string                 $sql      SQL snippet for extra filtering
  * @param array                  $bindings values to be inserted in SQL slots
  *
  * @return array
  */
 public static function related($bean, $type, $sql = '', $bindings = array())
 {
     return self::$associationManager->relatedSimple($bean, $type, $sql, $bindings);
 }
示例#3
0
 /**
  * Returns all the beans associated with $bean.
  * This method will return an array containing all the beans that have
  * been associated once with the associate() function and are still
  * associated with the bean specified. The type parameter indicates the
  * type of beans you are looking for. You can also pass some extra SQL and
  * values for that SQL to filter your results after fetching the
  * related beans.
  *
  * Dont try to make use of subqueries, a subquery using IN() seems to
  * be slower than two queries!
  *
  * Since 3.2, you can now also pass an array of beans instead just one
  * bean as the first parameter.
  *
  * @param RedBean_OODBBean|array $bean the bean you have
  * @param string				 $type the type of beans you want
  * @param string				 $sql  SQL snippet for extra filtering
  * @param array					 $val  values to be inserted in SQL slots
  *
  * @return array $beans	beans yielded by your query.
  */
 public static function related($bean, $type, $sql = null, $values = array())
 {
     return self::$associationManager->relatedSimple($bean, $type, $sql, $values);
 }