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
When setting the Category model attribute parent_id and save the model, the attribute should be persisted.
Current Behavior
When trying set the Category model attribute parent_id and save the model, it throws an error message:
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous (SQL: select `categories`.* from `categories` inner join `category_channel` on `categories`.`id` = `category_channel`.`category_id` and `category_channel`.`channel_id` = 1 and date(`category_channel`.`published_at`) <= 2020-12-08 inner join `category_customer_group` on `categories`.`id` = `category_customer_group`.`category_id` and `category_customer_group`.`customer_group_id` in (1) and `category_customer_group`.`visible` = 1 where `categories`.`drafted_at` is null and `id` = 4 group by `category_channel`.`category_id` limit 1)
Possible Solution
Currently, I'm utilizing the NodeTrait method setParentId() instead. The model should however be able to persist the attribute correctly, without resorting to trait methods (IMHO).
Steps to Reproduce
$category->parent_id = ($parent_id > 0) ? $parent_id : null; //current category ID is 4, parent_id is suppose to be set to 1$category->save(); // Results in previously described error message
Context (Environment)
The issue occured during an attempt to import categories from external source (ERP) and manually setting model primary key and parent ID.
Detailed Description
Possible Implementation
The text was updated successfully, but these errors were encountered:
Expected Behavior
When setting the
Category
model attributeparent_id
and save the model, the attribute should be persisted.Current Behavior
When trying set the
Category
model attributeparent_id
and save the model, it throws an error message:Possible Solution
Currently, I'm utilizing the
NodeTrait
methodsetParentId()
instead. The model should however be able to persist the attribute correctly, without resorting to trait methods (IMHO).Steps to Reproduce
Context (Environment)
The issue occured during an attempt to import categories from external source (ERP) and manually setting model primary key and parent ID.
Detailed Description
Possible Implementation
The text was updated successfully, but these errors were encountered: