\RedBeanPHP\UtilMultiLoader

Multi Bean Loader Helper

This code was originally part of the facade, however it has been decided to remove unique features to service classes like this to make them available to developers not using the facade class.

This helper class offers limited support for one-to-one relations by providing a service to load a set of beans with differnt types and a common ID.

Summary

Methods
Properties
Constants
load()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

load()

load(\RedBeanPHP\OODB  $oodb, string|array  $types, mixed  $id) : \RedBeanPHP\Util\OODBBean

Loads multiple types of beans with the same ID.

This might look like a strange method, however it can be useful for loading a one-to-one relation. In a typical 1-1 relation, you have two records sharing the same primary key. RedBeanPHP has only limited support for 1-1 relations. In general it is recommended to use 1-N for this.

Usage:

list( $author, $bio ) = R::loadMulti( 'author, bio', $id );

Parameters

\RedBeanPHP\OODB $oodb

OODB object

string|array $types

the set of types to load at once

mixed $id

the common ID

Returns

\RedBeanPHP\Util\OODBBean