Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Variables
downloadable_product_with_files_and_sample_url.php File Reference

Go to the source code of this file.

Variables

 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
 
 $product = $objectManager->create(\Magento\Catalog\Model\Product::class)
 
 $linkFactory = $objectManager->get(\Magento\Downloadable\Api\Data\LinkInterfaceFactory::class)
 
 $links = []
 
 $linkData
 
 $link = $linkFactory->create(['data' => $linkData])
 
 $links [] = $link
 
 $sampleContent = $objectManager->create(\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class)->create()
 
 $sampleLink = $linkFactory->create(['data' => $linkData])
 
 $content = $objectManager->create(\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class)->create()
 
 $downloadableData
 
 $extension = $product->getExtensionAttributes()
 
 $samples = []
 
 $sampleFactory = $objectManager->create(\Magento\Downloadable\Api\Data\SampleInterfaceFactory::class)
 
 $productRepository = $objectManager->get(\Magento\Catalog\Api\ProductRepositoryInterface::class)
 

Variable Documentation

◆ $content

Magento Downloadable Api Data File ContentInterface $content = $objectManager->create(\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class)->create()

◆ $downloadableData

$downloadableData
Initial value:
= [
'sample' => [
[
'is_delete' => 0,
'sample_id' => 0,
'title' => 'Downloadable Product Sample Title',
'file' => json_encode(
[
[
'file' => '/f/u/jellyfish_1_4.jpg',
'name' => 'jellyfish_1_4.jpg',
'size' => 1024,
'status' => 0,
],
]
),
'sample_url' => null,
'sort_order' => '0',
],
],
]

Definition at line 102 of file downloadable_product_with_files_and_sample_url.php.

◆ $extension

foreach ( $downloadableData[ 'sample'] as $sampleData) $extension = $product->getExtensionAttributes()

◆ $link

$link = $linkFactory->create(['data' => $linkData])

◆ $linkData

$linkData
Initial value:
= [
'title' => 'Downloadable Product Link',
'link_url' => 'http:
'link_id' => 0,
'is_delete' => null,
]

Definition at line 40 of file downloadable_product_with_files_and_sample_url.php.

◆ $linkFactory

Magento Downloadable Api Data LinkInterfaceFactory $linkFactory = $objectManager->get(\Magento\Downloadable\Api\Data\LinkInterfaceFactory::class)

◆ $links [1/2]

$links = []

◆ $links [2/2]

$links[] = $link

◆ $objectManager

◆ $product

$product = $objectManager->create(\Magento\Catalog\Model\Product::class)

◆ $productRepository

$productRepository = $objectManager->get(\Magento\Catalog\Api\ProductRepositoryInterface::class)

◆ $sampleContent

Magento Downloadable Api Data File ContentInterface $sampleContent = $objectManager->create(\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class)->create()

◆ $sampleFactory

$sampleFactory = $objectManager->create(\Magento\Downloadable\Api\Data\SampleInterfaceFactory::class)

◆ $sampleLink

$sampleLink = $linkFactory->create(['data' => $linkData])

◆ $samples

$samples = []