sourceResource = $sourceResource; $this->sourceFactory = $sourceFactory; } /** * @inheritdoc */ public function execute(string $sourceCode): SourceInterface { /** @var SourceInterface $source */ $source = $this->sourceFactory->create(); $this->sourceResource->load($source, $sourceCode, SourceInterface::SOURCE_CODE); if (null === $source->getSourceCode()) { throw new NoSuchEntityException(__('Source with code "%value" does not exist.', ['value' => $sourceCode])); } return $source; } }