Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpToDateDeclarativeSchema.php
Go to the documentation of this file.
1 <?php
7 declare(strict_types=1);
8 
10 
13 
18 {
22  private $schemaConfig;
23 
27  private $schemaDiff;
28 
34  public function __construct(
35  SchemaConfigInterface $schemaConfig,
36  SchemaDiff $schemaDiff
37  ) {
38  $this->schemaConfig = $schemaConfig;
39  $this->schemaDiff = $schemaDiff;
40  }
41 
45  public function getNotUpToDateMessage() : string
46  {
47  return 'Declarative Schema is not up to date';
48  }
49 
53  public function isUpToDate() : bool
54  {
55  $declarativeSchema = $this->schemaConfig->getDeclarationConfig();
56  $dbSchema = $this->schemaConfig->getDbConfig();
57  $diff = $this->schemaDiff->diff($declarativeSchema, $dbSchema);
58  return empty($diff->getAll());
59  }
60 }
__construct(SchemaConfigInterface $schemaConfig, SchemaDiff $schemaDiff)