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
CreateHandler.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\Downloadable\Model\Product\Type
;
10
use
Magento\Framework\EntityManager\Operation\ExtensionInterface
;
11
15
class
CreateHandler
implements
ExtensionInterface
16
{
20
protected
$linkRepository
;
21
25
public
function
__construct
(
LinkRepository
$linkRepository
)
26
{
27
$this->linkRepository =
$linkRepository
;
28
}
29
36
public
function
execute
(
$entity
,
$arguments
= [])
37
{
39
if
(
$entity
->getTypeId() !=
Type::TYPE_DOWNLOADABLE
) {
40
return
$entity
;
41
}
42
44
$links
=
$entity
->getExtensionAttributes()->getDownloadableProductLinks() ?: [];
45
foreach
(
$links
as
$link
) {
46
$link
->setId(
null
);
47
$this->linkRepository->save(
$entity
->getSku(),
$link
, !(bool)
$entity
->getStoreId());
48
}
49
50
return
$entity
;
51
}
52
}
Magento\Framework\EntityManager\Operation\ExtensionInterface
Definition:
ExtensionInterface.php:11
Magento\Downloadable\Model\Link\CreateHandler\__construct
__construct(LinkRepository $linkRepository)
Definition:
CreateHandler.php:25
Magento\Downloadable\Model\Link\CreateHandler
Definition:
CreateHandler.php:15
Magento\Framework\EntityManager\Operation\ExtensionInterface\execute
execute($entity, $arguments=[])
Magento\Downloadable\Model\Link
Definition:
Builder.php:6
$link
$link
Definition:
quote_with_downloadable_product.php:27
$links
$links
Definition:
downloadable_product_with_files_and_sample_url.php:39
Magento\Downloadable\Model\Product\Type
Definition:
Type.php:18
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\CreateHandler\$linkRepository
$linkRepository
Definition:
CreateHandler.php:20