杂货CRUD加入表 [英] Grocery CRUD Join table
本文介绍了杂货CRUD加入表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
需要一些帮助来建立产品和数量之间的关系。
Need some help to make a relationship between products and quantity.
Table1: Products
Columns: id , code, unit, name, size , cost , price
-
Table2: qty_products
Columns: id , product_id , warehouse_id , quantity
这些产品之间的关系是 id
从产品
和 product_id
从 qty_products
the relation between products here is id
from products
and product_id
from qty_products
一个简单的查询结果是: p>
a simple query for this result is:
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。
this result i need to translate to 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还不支持连接新表的选项,所以我决定创建一个新模型,在这里看到结果和解决方案。
yes, Grocery CRUD doesn't support yet the option to join a new table, so i resolved it creating a new model, see result and solution here.
这篇关于杂货CRUD加入表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文