Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
QuoteConfiguration.php
Go to the documentation of this file.
1 <?php
8 
10 
15 {
21  const BIG_CONFIGURABLE_TYPE = 'big_configurable';
22 
29 
36 
43 
50 
57 
64 
70  protected $_globalMap = [
71  'order_simple_product_count_to' => 'simple_count_to',
72  'order_simple_product_count_from' => 'simple_count_from',
73  'order_configurable_product_count_to' => 'configurable_count_to',
74  'order_configurable_product_count_from' => 'configurable_count_from',
75  'order_big_configurable_product_count_to' => 'big_configurable_count_to',
76  'order_big_configurable_product_count_from' => 'big_configurable_count_from',
77  'order_quotes_enable' => 'order_quotes_enable',
78  ];
79 
83  protected $fixtureDataFilename = 'orders_fixture_data.json';
84 
88  private $fixtureModel;
89 
93  public function __construct(FixtureModel $fixtureModel)
94  {
95  $this->fixtureModel = $fixtureModel;
96  }
97 
103  public function load()
104  {
105  $this->addData([
106  'simple_count_to' => self::SIMPLE_PRODUCT_COUNT_TO,
107  'simple_count_from' => self::SIMPLE_PRODUCT_COUNT_FROM,
108  'configurable_count_to' => self::CONFIGURABLE_PRODUCT_COUNT_TO,
109  'configurable_count_from' => self::CONFIGURABLE_PRODUCT_COUNT_FROM,
110  'big_configurable_count_to' => self::BIG_CONFIGURABLE_PRODUCT_COUNT_TO,
111  'big_configurable_count_from' => self::BIG_CONFIGURABLE_PRODUCT_COUNT_FROM,
112  ]);
113 
114  $this->setData(
115  'fixture_data_filename',
116  dirname(__DIR__) . DIRECTORY_SEPARATOR . "_files" . DIRECTORY_SEPARATOR . $this->fixtureDataFilename
117  );
118  $this->accumulateData();
119 
120  return $this;
121  }
122 
128  private function accumulateData()
129  {
130  foreach ($this->_globalMap as $getKey => $setKey) {
131  $value = $this->fixtureModel->getValue($getKey);
132  if (null !== $value) {
133  $this->setData($setKey, $value);
134  }
135  }
136  return $this;
137  }
138 }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$value
Definition: gender.phtml:16
setData($key, $value=null)
Definition: DataObject.php:72