我通过这种方式存储了一个产品 Bean:
$product = R::dispense( 'product' );
$product->name = $_POST['name'];
$product->description = $_POST['description'];
$product->price = $_POST['price'];
$product->category = $_POST['category'];
R::store( $product );
如何指示类别的属性是对类别 Bean 的 id 引用(或 FK)?我想像这样获得类别 Bean:
$products = R::find( 'product' );
foreach( $products as $product )
$productCategory = $product->category->name;