Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SchemaConfig.php
Go to the documentation of this file.
1 <?php
8 
14 
19 {
23  private $dbSchemaBuilder;
24 
28  private $declarativeSchemaBuilder;
29 
33  private $schemaFactory;
34 
38  private $readerComposite;
39 
48  public function __construct(
49  DbSchemaBuilder $dbSchemaBuilder,
50  DeclarativeSchemaBuilder $declarativeSchemaBuilder,
51  SchemaFactory $schemaFactory,
52  ReaderComposite $readerComposite
53  ) {
54  $this->dbSchemaBuilder = $dbSchemaBuilder;
55  $this->declarativeSchemaBuilder = $declarativeSchemaBuilder;
56  $this->schemaFactory = $schemaFactory;
57  $this->readerComposite = $readerComposite;
58  }
59 
63  public function getDbConfig()
64  {
65  $schema = $this->schemaFactory->create();
66  $schema = $this->dbSchemaBuilder->build($schema);
67  return $schema;
68  }
69 
73  public function getDeclarationConfig()
74  {
75  $schema = $this->schemaFactory->create();
76  $data = $this->readerComposite->read(FileResolverByModule::ALL_MODULES);
77  $this->declarativeSchemaBuilder->addTablesData($data['table']);
78  $schema = $this->declarativeSchemaBuilder->build($schema);
79  return $schema;
80  }
81 }
__construct(DbSchemaBuilder $dbSchemaBuilder, DeclarativeSchemaBuilder $declarativeSchemaBuilder, SchemaFactory $schemaFactory, ReaderComposite $readerComposite)