Open
Description
Summary
In LineItemHandler there is a part where case for new ShoppingList creation is seemingly covered, but it's never called, and looks like dead code to me:
// handle case for new shopping list creation
$formName = $this->form->getName();
$formData = $this->request->request->get($formName, []);
if (empty($formData['shoppingList']) && !empty($formData['shoppingListLabel'])) {
$shoppingList = $this->currentShoppingListManager->createCurrent($formData['shoppingListLabel']);
$formData['shoppingList'] = $shoppingList->getId();
$this->request->request->set($formName, $formData);
}
This handler is called only in
\Oro\Bundle\ShoppingListBundle\Controller\Frontend\AjaxLineItemController::addProductFromViewAction
where ShoppingList is always created before, if it didn't exist:
https://github.com/oroinc/orocommerce/blob/master/src/Oro/Bundle/ShoppingListBundle/Controller/Frontend/AjaxLineItemController.php#L59
$shoppingList = $currentShoppingListManager->getForCurrentUser($request->get('shoppingListId'));
https://github.com/oroinc/orocommerce/blob/master/src/Oro/Bundle/ShoppingListBundle/Controller/Frontend/Api/Rest/LineItemController.php#L144
\Oro\Bundle\ShoppingListBundle\Controller\Frontend\Api\Rest\LineItemController::putAction
which is responsible for updating a LineItem, so it must be assigned to a ShoppingList already.
JK
Metadata
Metadata
Assignees
Labels
No labels