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
Sample
ReadHandler.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Downloadable\Model\Sample
;
7
8
use
Magento\Downloadable\Api\SampleRepositoryInterface
as SampleRepository;
9
use
Magento\Framework\EntityManager\Operation\ExtensionInterface
;
10
14
class
ReadHandler
implements
ExtensionInterface
15
{
19
protected
$sampleRepository
;
20
24
public
function
__construct
(
SampleRepository
$sampleRepository
)
25
{
26
$this->sampleRepository =
$sampleRepository
;
27
}
28
35
public
function
execute
(
$entity
,
$arguments
= [])
36
{
38
if
(
$entity
->getTypeId() !=
\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE
) {
39
return
$entity
;
40
}
41
$entityExtension =
$entity
->getExtensionAttributes();
42
$samples
= $this->sampleRepository->getSamplesByProduct(
$entity
);
43
if
(
$samples
) {
44
$entityExtension->setDownloadableProductSamples(
$samples
);
45
}
46
$entity
->setExtensionAttributes($entityExtension);
47
return
$entity
;
48
}
49
}
$samples
$samples
Definition:
downloadable_product_with_files_and_sample_url.php:127
Magento\Downloadable\Model\Sample\ReadHandler
Definition:
ReadHandler.php:14
Magento\Framework\EntityManager\Operation\ExtensionInterface
Definition:
ExtensionInterface.php:11
Magento\Downloadable\Model\Sample
Definition:
Builder.php:6
Magento\Downloadable\Model\Sample\ReadHandler\$sampleRepository
$sampleRepository
Definition:
ReadHandler.php:19
Magento\Framework\EntityManager\Operation\ExtensionInterface\execute
execute($entity, $arguments=[])
$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\Model\SampleRepository
Definition:
SampleRepository.php:28
Magento\Downloadable\Api\SampleRepositoryInterface
Definition:
SampleRepositoryInterface.php:15
Magento\Downloadable\Model\Sample\ReadHandler\__construct
__construct(SampleRepository $sampleRepository)
Definition:
ReadHandler.php:24