You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a table with a combined primary key. Its not necessary to have relational tablestructure in this case, because its only a temporary table to hold the products which a user puts in a basket. I just want to ensure that at the moment of ordering the basket, the products will be still the same as when put in the basket, in case somebody is changing product details in meanwhile
structure is:
basket_id
user_id
id (of product)
name (of product)
description (of product)
partnumber (of product)
price (of product)
quantity (of product to be ordered)
EAN (of product)
weight (of product)
the combined key ist: basket_id + user_id + id
at the moment I do:
$basketProducts = $this->Bproducts->find()
->where(['basket_id' => $basketId, 'user_id' => $userId, 'id' => $productId])
->toArray();
I wonder how to specify with get() since from my understaning I can only pass one value as key to get()
The text was updated successfully, but these errors were encountered:
honestly that easy?
primary key is already defined in table.
did not think about specifying like that in get().
i could not find some hint in documentation, about that yesterday night. thanks so far.
Sorry, this is not working in this way.
I receive following error:
Record not found in table "bproducts" with primary key [38, 9, 2]
this is my table definition:
public function initialize(array $config)
{
$this->table('bproducts');
$this->displayField('name');
$this->primaryKey('basket_id', 'user_id', 'id');
}
Hi there, really wondering how this works:
I have a table with a combined primary key. Its not necessary to have relational tablestructure in this case, because its only a temporary table to hold the products which a user puts in a basket. I just want to ensure that at the moment of ordering the basket, the products will be still the same as when put in the basket, in case somebody is changing product details in meanwhile
structure is:
basket_id
user_id
id (of product)
name (of product)
description (of product)
partnumber (of product)
price (of product)
quantity (of product to be ordered)
EAN (of product)
weight (of product)
the combined key ist: basket_id + user_id + id
at the moment I do:
$basketProducts = $this->Bproducts->find()
->where(['basket_id' => $basketId, 'user_id' => $userId, 'id' => $productId])
->toArray();
I wonder how to specify with get() since from my understaning I can only pass one value as key to get()
The text was updated successfully, but these errors were encountered: