public function load($modelId, $field = null) { parent::load($modelId, $field); $this->setId($modelId); // array_filter to remove empty items caused by non-magento modules requirements $this->setDepends(array_filter($this->packageInfo->getRequire($this->getCode()))); $this->setVersion($this->packageInfo->getVersion($this->getCode())); $this->setPackageName($this->packageInfo->getPackageName($this->getCode())); return $this; }
public function testGetRequireReturnModuleName() { $this->assertEquals(['B'], $this->packageInfo->getRequire('A')); $this->assertEquals(['D'], $this->packageInfo->getRequire('B')); $this->assertEquals(['E'], $this->packageInfo->getRequire('C')); $this->assertEquals([], $this->packageInfo->getRequire('D')); $this->assertEquals([], $this->packageInfo->getRequire('E')); }
/** * Create the dependency graph * * @return Graph */ private function createGraph() { $nodes = []; $dependencies = []; // build the graph data foreach (array_keys($this->fullModuleList) as $moduleName) { $nodes[] = $moduleName; foreach ($this->packageInfo->getRequire($moduleName) as $dependModuleName) { if ($dependModuleName) { $dependencies[] = [$moduleName, $dependModuleName]; } } } $nodes = array_unique(array_merge($nodes, $this->packageInfo->getNonExistingDependencies())); return new Graph($nodes, $dependencies); }