Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
PackagePool Class Reference

Public Member Functions

 __construct (Collector $collector, ListInterface $themeCollection, PackageFactory $packageFactory)
 
 getPackage ($path)
 
 getPackages ()
 
 getThemeModel ($areaCode, $themePath)
 
 getPackagesForDeployment (array $options)
 

Detailed Description

Deployment Packages Pool class

Definition at line 17 of file PackagePool.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Collector  $collector,
ListInterface  $themeCollection,
PackageFactory  $packageFactory 
)

PackagePool constructor

Parameters
Collector$collector
ListInterface$themeCollection
PackageFactory$packageFactory

Definition at line 51 of file PackagePool.php.

55  {
56  $this->collector = $collector;
57  $themeCollection->clear()->resetConstraints();
58  $this->themes = $themeCollection->getItems();
59  $this->packageFactory = $packageFactory;
60  }

Member Function Documentation

◆ getPackage()

getPackage (   $path)
Parameters
string$path
Returns
Package|null

Definition at line 66 of file PackagePool.php.

67  {
68  $this->collect();
69  return isset($this->packages[$path]) ? $this->packages[$path] : null;
70  }

◆ getPackages()

getPackages ( )
Returns
Package[]

Definition at line 75 of file PackagePool.php.

76  {
77  $this->collect();
78  return $this->packages;
79  }

◆ getPackagesForDeployment()

getPackagesForDeployment ( array  $options)
Parameters
array$options
Returns
Package[]

Definition at line 99 of file PackagePool.php.

100  {
101  $this->collect();
102  $this->ensurePackagesForRequiredLocales($options);
103 
104  $toSkip = [];
105  $toDeploy = [];
106  foreach ($this->packages as $path => $package) {
107  if ($this->checkPackageSkip($package, $options)) {
108  $toSkip[$path] = $package;
109  continue;
110  } else {
111  $toDeploy[$path] = $package;
112  }
113  }
114 
115  foreach ($toSkip as $path => $package) {
116  if (!$this->isAncestorForDeployedPackages($package, $toDeploy)) {
117  unset($this->packages[$path]);
118  }
119  }
120 
121  return $this->packages;
122  }

◆ getThemeModel()

getThemeModel (   $areaCode,
  $themePath 
)
Parameters
string$areaCode
string$themePath
Returns
ThemeInterface|null

Definition at line 86 of file PackagePool.php.

87  {
88  $theme = $this->getThemeByFullPath($areaCode . '/' . $themePath);
89  if ($theme && !$theme->getThemePath()) {
90  $theme->setThemePath($themePath);
91  }
92  return $theme;
93  }
$theme

The documentation for this class was generated from the following file: