many to many in redbeanphp is not full

Jack burridge

I've created bean called user

$user =  = R::dispense('user');
$user->sharedInstrument = $instruments;

And create an instrument where the owner is a user and many users can view it

$instrument = R::dispense('instrument');
$instrument->sharedUser = $users;
$instrument->owner = $owner;

The problem is when I load an instrument $instrument->sharedUser seems to only consist of the owner. Is there a way to get around this other than using R::related($instrument,'user')?

Jack burridge

Found out how to do it use preload with an alias.

R::preload($instrument,array('sharedUser'=>'user'));

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related