Wishlist.php 917 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\Controller\Adminhtml\Index;
  7. class Wishlist extends \Magento\Customer\Controller\Adminhtml\Index
  8. {
  9. /**
  10. * Wishlist Action
  11. *
  12. * @return \Magento\Framework\View\Result\Layout
  13. */
  14. public function execute()
  15. {
  16. $customerId = $this->initCurrentCustomer();
  17. $itemId = (int)$this->getRequest()->getParam('delete');
  18. if ($customerId && $itemId) {
  19. try {
  20. $this->_objectManager->create(\Magento\Wishlist\Model\Item::class)->load($itemId)->delete();
  21. } catch (\Exception $exception) {
  22. $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($exception);
  23. }
  24. }
  25. $resultLayout = $this->resultLayoutFactory->create();
  26. return $resultLayout;
  27. }
  28. }