Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Delete.php
Go to the documentation of this file.
1 <?php
7 
13 
17 class Delete extends AbstractAction
18 {
23 
27  private $bookmarkManagement;
28 
35  public function __construct(
36  Context $context,
39  BookmarkManagementInterface $bookmarkManagement
40  ) {
41  parent::__construct($context, $factory);
42  $this->bookmarkRepository = $bookmarkRepository;
43  $this->bookmarkManagement = $bookmarkManagement;
44  }
45 
51  public function execute()
52  {
53  $viewIds = explode('.', $this->_request->getParam('data'));
54  $bookmark = $this->bookmarkManagement->getByIdentifierNamespace(
55  array_pop($viewIds),
56  $this->_request->getParam('namespace')
57  );
58 
59  if ($bookmark && $bookmark->getId()) {
60  $this->bookmarkRepository->delete($bookmark);
61  }
62  }
63 }
__construct(Context $context, UiComponentFactory $factory, BookmarkRepositoryInterface $bookmarkRepository, BookmarkManagementInterface $bookmarkManagement)
Definition: Delete.php:35