/**
  * 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
  * @param string                 $type      the type of beans you want
  * @param string                 $sql       SQL snippet for extra filtering
  * @param array                  $bindings  values to be inserted in SQL slots
  * @param boolean                $glue      whether the SQL should be prefixed with WHERE
  *
  * @return array
  */
 public function relatedSimple($bean, $type, $sql = '', $bindings = array())
 {
     $sql = $this->writer->glueSQLCondition($sql);
     $rows = $this->relatedRows($bean, $type, FALSE, $sql, $bindings);
     $links = array();
     foreach ($rows as $key => $row) {
         if (!isset($links[$row['id']])) {
             $links[$row['id']] = array();
         }
         $links[$row['id']][] = $row['linked_by'];
         unset($rows[$key]['linked_by']);
     }
     $beans = $this->oodb->convertToBeans($type, $rows);
     foreach ($beans as $bean) {
         $bean->setMeta('sys.belongs-to', $links[$bean->id]);
     }
     return $beans;
 }