Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-downloadable
Model
Link
DeleteHandler.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Downloadable\Model\Link
;
7
8
use
Magento\Downloadable\Api\LinkRepositoryInterface
as LinkRepository;
9
use
Magento\Framework\EntityManager\Operation\ExtensionInterface
;
10
14
class
DeleteHandler
implements
ExtensionInterface
15
{
19
protected
$linkRepository
;
20
24
public
function
__construct
(
LinkRepository
$linkRepository
)
25
{
26
$this->linkRepository =
$linkRepository
;
27
}
28
35
public
function
execute
(
$entity
,
$arguments
= [])
36
{
37
if
(
$entity
->getTypeId() !=
\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE
) {
38
return
$entity
;
39
}
41
foreach
($this->linkRepository->getList(
$entity
->getSku()) as
$link
) {
42
$this->linkRepository->delete(
$link
->getId());
43
}
44
return
$entity
;
45
}
46
}
Magento\Framework\EntityManager\Operation\ExtensionInterface
Definition:
ExtensionInterface.php:11
Magento\Framework\EntityManager\Operation\ExtensionInterface\execute
execute($entity, $arguments=[])
Magento\Downloadable\Model\Link\DeleteHandler\$linkRepository
$linkRepository
Definition:
DeleteHandler.php:19
Magento\Downloadable\Model\Link
Definition:
Builder.php:6
$link
$link
Definition:
quote_with_downloadable_product.php:27
Magento\Downloadable\Model\Link\DeleteHandler
Definition:
DeleteHandler.php:14
Magento\Downloadable\Model\LinkRepository
Definition:
LinkRepository.php:25
$entity
$entity
Definition:
element.phtml:22
$arguments
$arguments
Definition:
final_price.phtml:24
Magento\Downloadable\Model\Product\Type\TYPE_DOWNLOADABLE
const TYPE_DOWNLOADABLE
Definition:
Type.php:20
Magento\Downloadable\Api\LinkRepositoryInterface
Definition:
LinkRepositoryInterface.php:17
Magento\Downloadable\Model\Link\DeleteHandler\__construct
__construct(LinkRepository $linkRepository)
Definition:
DeleteHandler.php:24