Relationship trouble

10 views
Skip to first unread message

itvik...@gmail.com

unread,
Jul 11, 2015, 4:36:10 PM7/11/15
to redbe...@googlegroups.com
Hi. I have 2 tables : shop and productand relationship one to many



$shop = R::dispense( 'shop' );
$shop
->name = 'Antiques';
$vase
= R::dispense( 'product' );
$vase
->price = 25;
$shop
->ownProductList[] = $vase;
R
::store( $shop );

I want to add the product to the store knowing the ID store 
$shop = R::load( 'shop', $id );
$flower
= R::dispense( 'product' );
$flower
->price = 100500;
$shop
->ownProductList[]=$flower;
R
::store($shop);
How do I do this without calling the shop by id?
Reply all
Reply to author
Forward
0 new messages