/** * @return Sample */ private function getComponent() { if (!$this->component) { $this->component = $this->componentFactory->create(); } return $this->component; }
/** * {@inheritdoc} */ public function delete($id) { /** @var $sample \Magento\Downloadable\Model\Sample */ $sample = $this->sampleFactory->create()->load($id); if (!$sample->getId()) { throw new NoSuchEntityException(__('There is no downloadable sample with provided ID.')); } try { $sample->delete(); } catch (\Exception $exception) { throw new StateException(__('Cannot delete sample with id %1', $sample->getId()), $exception); } return true; }
/** * @return \Magento\Downloadable\Model\Sample */ protected function _createSample() { return $this->_sampleFactory->create(); }
/** * @return ComponentInterface */ protected function createItem() { return $this->sampleFactory->create(); }