Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PatchBackwardCompatability.php
Go to the documentation of this file.
1 <?php
7 declare(strict_types=1);
8 
10 
12 
17 {
21  private $moduleResource;
22 
28  public function __construct(ModuleResource $moduleResource)
29  {
30  $this->moduleResource = $moduleResource;
31  }
32 
40  public function isSkipableByDataSetupVersion(string $patchClassName, string $moduleName) : bool
41  {
42  $dbVersion = (string) $this->moduleResource->getDataVersion($moduleName);
43  return in_array(PatchVersionInterface::class, class_implements($patchClassName)) &&
44  version_compare(call_user_func([$patchClassName, 'getVersion']), $dbVersion) <= 0;
45  }
46 
54  public function isSkipableBySchemaSetupVersion(string $patchClassName, string $moduleName) : bool
55  {
56  $dbVersion = (string) $this->moduleResource->getDbVersion($moduleName);
57  return in_array(PatchVersionInterface::class, class_implements($patchClassName)) &&
58  version_compare(call_user_func([$patchClassName, 'getVersion']), $dbVersion) <= 0;
59  }
60 }
isSkipableBySchemaSetupVersion(string $patchClassName, string $moduleName)
isSkipableByDataSetupVersion(string $patchClassName, string $moduleName)