/** * Add user selected products. * * @param CategoryInterface $category Category. * * @return $this */ private function addSelectedProducts(CategoryInterface $category) { $selectedProducts = $this->getRequest()->getParam('selected_products', []); $addedProducts = isset($selectedProducts['added_products']) ? $selectedProducts['added_products'] : []; $category->setAddedProductIds($addedProducts); $deletedProducts = isset($selectedProducts['deleted_products']) ? $selectedProducts['deleted_products'] : []; $category->setDeletedProductIds($deletedProducts); return $this; }