Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
InstallEntityTypes.php
Go to the documentation of this file.
1 <?php
8 
11 use Magento\Quote\Setup\QuoteSetupFactory;
14 
15 /***
16  * Class InstallEntityTypes
17  * @package Magento\Quote\Setup\Patch
18  */
20 {
24  private $moduleDataSetup;
25 
29  private $quoteSetupFactory;
30 
36  public function __construct(
37  \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup,
38  QuoteSetupFactory $quoteSetupFactory
39  ) {
40  $this->moduleDataSetup = $moduleDataSetup;
41  $this->quoteSetupFactory = $quoteSetupFactory;
42  }
43 
47  public function apply()
48  {
50  $quoteSetup = $this->quoteSetupFactory->create(['setup' => $this->moduleDataSetup]);
51 
55  $attributes = [
56  'vat_id' => ['type' => Table::TYPE_TEXT],
57  'vat_is_valid' => ['type' => Table::TYPE_SMALLINT],
58  'vat_request_id' => ['type' => Table::TYPE_TEXT],
59  'vat_request_date' => ['type' => Table::TYPE_TEXT],
60  'vat_request_success' => ['type' => Table::TYPE_SMALLINT],
61  ];
62  foreach ($attributes as $attributeCode => $attributeParams) {
63  $quoteSetup->addAttribute('quote_address', $attributeCode, $attributeParams);
64  }
65  }
66 
70  public static function getDependencies()
71  {
72  return [];
73  }
74 
78  public static function getVersion()
79  {
80  return '2.0.0';
81  }
82 
86  public function getAliases()
87  {
88  return [];
89  }
90 }
$attributeCode
Definition: extend.phtml:12
$attributes
Definition: matrix.phtml:13
__construct(\Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup, QuoteSetupFactory $quoteSetupFactory)