diff --git a/Model/Component/Websites.php b/Model/Component/Websites.php index 5bf7dff..a8e91fe 100644 --- a/Model/Component/Websites.php +++ b/Model/Component/Websites.php @@ -38,6 +38,12 @@ protected function canParseAndProcess() protected function parseData($source = null) { try { + if ($source == null) { + throw new ComponentException( + sprintf('The %s component requires to have a file source definition.', $this->alias) + ); + } + $parser = new Yaml(); return $parser->parse(file_get_contents($source)); } catch (ComponentException $e) { @@ -93,7 +99,7 @@ protected function processWebsite($code, $websiteData) try { // Load website via ObjectManager - $this->log->logQuestion(sprintf("Does the the website with code '%s' already exist?", $code), $logNest); + $this->log->logQuestion(sprintf("Does the website with code '%s' already exist?", $code), $logNest); $websiteFactory = new WebsiteFactory($this->objectManager, \Magento\Store\Model\Website::class); $website = $websiteFactory->create(); $website->load($code, 'code'); @@ -102,6 +108,7 @@ protected function processWebsite($code, $websiteData) // Check if it exists if ($website->getId()) { + $this->log->logInfo("Yes",$logNest); $this->log->logComment(sprintf("Website already exists with code '%s'", $code), $logNest); } else { @@ -185,6 +192,7 @@ protected function processStoreGroup($storeGroupData, Website $website) // Check if the store group already exists if ($storeGroup->getId()) { + $this->log->logInfo("Yes",$logNest); $this->log->logComment( sprintf("Store group already exists with name '%s'", $storeGroupData['name']), $logNest @@ -254,6 +262,7 @@ protected function processStoreView($code, $storeViewData, Group $storeGroup) // Check if it exists if ($storeView->getId()) { + $this->log->logInfo("Yes",$logNest); $this->log->logComment(sprintf("Store view already exists with code '%s'", $code), $logNest); } else { diff --git a/Model/Processor.php b/Model/Processor.php index f92f4d4..cc13ac0 100644 --- a/Model/Processor.php +++ b/Model/Processor.php @@ -6,6 +6,7 @@ use CtiDigital\Configurator\Model\Configurator\ConfigInterface; use CtiDigital\Configurator\Model\Exception\ComponentException; use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Profiler\Driver\Standard\OutputInterface; use Symfony\Component\Yaml\Parser; class Processor @@ -113,6 +114,8 @@ public function run() $masterPath = BP . '/app/etc/master.yaml'; if (!file_exists($masterPath)) { throw new ComponentException("Master YAML does not exist. Please create one in $masterPath"); + } else { + $this->log->logComment(sprintf("Found Master YAML")); } $yamlContents = file_get_contents($masterPath); $yaml = new Parser(); @@ -126,6 +129,8 @@ public function run() // Loop through components and run them individually in the master.yaml order foreach ($master as $componentAlias => $componentConfig) { + $this->log->logComment(sprintf("Loading component %s", $componentAlias)); + $componentClass = $this->configInterface->getComponentByName($componentAlias); /* @var ComponentAbstract $component */ @@ -191,7 +196,11 @@ public function run() */ private function isValidComponent($componentName) { + if ($this->log->getLogLevel() > \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL) { + $this->log->logQuestion(sprintf("Does the %s component exist?", $componentName)); + } $componentClass = $this->configInterface->getComponentByName($componentName); + $this->log->logComment(sprintf("The %s component has %s class name.", $componentName, $componentClass)); $component = $this->objectManager->create($componentClass); if ($component instanceof ComponentAbstract) { return true;