Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NoWebApiXml.php
Go to the documentation of this file.
1 <?php
7 
9 use Magento\TestModule2\Service\V1\Entity\ItemFactory;
10 
12 {
16  protected $itemFactory;
17 
21  public function __construct(ItemFactory $itemFactory)
22  {
23  $this->itemFactory = $itemFactory;
24  }
25 
29  public function item($id)
30  {
31  return $this->itemFactory->create()->setId($id)->setName('testProduct1');
32  }
33 
37  public function items()
38  {
39  $result1 = $this->itemFactory->create()->setId(1)->setName('testProduct1');
40 
41  $result2 = $this->itemFactory->create()->setId(2)->setName('testProduct2');
42 
43  return [$result1, $result2];
44  }
45 
49  public function create($name)
50  {
51  return $this->itemFactory->create()->setId(rand())->setName($name);
52  }
53 
57  public function update(Item $item)
58  {
59  return $this->itemFactory->create()->setId($item->getId())->setName('Updated' . $item->getName());
60  }
61 }
__construct(ItemFactory $itemFactory)
Definition: NoWebApiXml.php:21
$id
Definition: fieldset.phtml:14
if(!isset($_GET['name'])) $name
Definition: log.php:14