[英]Grocery CRUD Join table
需要一些帮助来建立产品和数量之间的关系。
Table1: Products
Columns: id , code, unit, name, size , cost , price
-
Table2: qty_products
Columns: id , product_id , warehouse_id , quantity
这里的products
之间的关系是来自products
id
和来自qty_products
product_id
对此结果的简单查询是:
SELECT p.id, p.code, p.unit, p.name, p.size, p.cost, p.price, s.quantity, s.warehouse_id FROM products p
INNER JOIN qty_products s ON s.product_id = p.id
这个结果我需要翻译成Grocery CRUD。
function products()
{
$crud = new grocery_CRUD();
$crud->set_table('products');
$crud->set_relation('column','table','column');
$output = $crud->render();
$this->_products($output);
}
任何帮助表示赞赏。
是的,Grocery CRUD还不支持加入新表的选项,所以我决定创建一个新模型,在这里查看结果和解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.