1 | <?php |
||
41 | class ConfigurationLoader extends SimpleConfigurationLoader |
||
42 | { |
||
43 | |||
44 | /** |
||
45 | * The array with the default entity type code => import directory mappings. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $defaultDirectories = array( |
||
50 | EntityTypeCodes::CATALOG_PRODUCT => 'products', |
||
51 | EntityTypeCodes::CATALOG_PRODUCT_PRICE => 'products', |
||
52 | EntityTypeCodes::CATALOG_PRODUCT_TIER_PRICE => 'products', |
||
53 | EntityTypeCodes::CATALOG_PRODUCT_INVENTORY => 'products', |
||
54 | EntityTypeCodes::CATALOG_PRODUCT_INVENTORY_MSI => 'products', |
||
55 | EntityTypeCodes::CATALOG_CATEGORY => 'categories', |
||
56 | EntityTypeCodes::EAV_ATTRIBUTE => 'attributes', |
||
57 | EntityTypeCodes::EAV_ATTRIBUTE_SET => 'attributes', |
||
58 | EntityTypeCodes::CUSTOMER => 'customers', |
||
59 | EntityTypeCodes::CUSTOMER_ADDRESS => 'customers' |
||
60 | ); |
||
61 | |||
62 | /** |
||
63 | * The Magento Edition specific default libraries. |
||
64 | * |
||
65 | * @var array |
||
66 | */ |
||
67 | protected $defaultLibraries = array( |
||
68 | 'ce' => array( |
||
69 | 'techdivision/import-app-simple', |
||
70 | 'techdivision/import', |
||
71 | 'techdivision/import-attribute', |
||
72 | 'techdivision/import-attribute-set', |
||
73 | 'techdivision/import-category', |
||
74 | 'techdivision/import-customer', |
||
75 | 'techdivision/import-customer-address', |
||
76 | 'techdivision/import-product', |
||
77 | 'techdivision/import-product-msi', |
||
78 | 'techdivision/import-product-tier-price', |
||
79 | 'techdivision/import-product-url-rewrite', |
||
80 | 'techdivision/import-product-bundle', |
||
81 | 'techdivision/import-product-link', |
||
82 | 'techdivision/import-product-media', |
||
83 | 'techdivision/import-product-variant', |
||
84 | 'techdivision/import-product-grouped' |
||
85 | ), |
||
86 | 'ee' => array( |
||
87 | 'techdivision/import-app-simple', |
||
88 | 'techdivision/import', |
||
89 | 'techdivision/import-ee', |
||
90 | 'techdivision/import-attribute', |
||
91 | 'techdivision/import-attribute-set', |
||
92 | 'techdivision/import-category', |
||
93 | 'techdivision/import-category-ee', |
||
94 | 'techdivision/import-customer', |
||
95 | 'techdivision/import-customer-address', |
||
96 | 'techdivision/import-product', |
||
97 | 'techdivision/import-product-msi', |
||
98 | 'techdivision/import-product-tier-price', |
||
99 | 'techdivision/import-product-url-rewrite', |
||
100 | 'techdivision/import-product-ee', |
||
101 | 'techdivision/import-product-bundle', |
||
102 | 'techdivision/import-product-bundle-ee', |
||
103 | 'techdivision/import-product-link', |
||
104 | 'techdivision/import-product-link-ee', |
||
105 | 'techdivision/import-product-media', |
||
106 | 'techdivision/import-product-media-ee', |
||
107 | 'techdivision/import-product-variant', |
||
108 | 'techdivision/import-product-variant-ee', |
||
109 | 'techdivision/import-product-grouped', |
||
110 | 'techdivision/import-product-grouped-ee' |
||
111 | ) |
||
112 | ); |
||
113 | |||
114 | /** |
||
115 | * Factory implementation to create a new initialized configuration instance. |
||
116 | * |
||
117 | * If command line options are specified, they will always override the |
||
118 | * values found in the configuration file. |
||
119 | * |
||
120 | * @return \TechDivision\Import\ConfigurationInterface The configuration instance |
||
121 | * @throws \Exception Is thrown, if the specified configuration file doesn't exist or the mandatory arguments/options to run the requested operation are not available |
||
122 | */ |
||
123 | public function load() |
||
270 | |||
271 | /** |
||
272 | * Query whether or not, the passed directory is a Magento root directory. |
||
273 | * |
||
274 | * @param string $dir The directory to query |
||
275 | * |
||
276 | * @return boolean TRUE if the directory is a Magento root directory, else FALSE |
||
277 | */ |
||
278 | protected function isMagentoRootDir($dir) |
||
282 | |||
283 | /** |
||
284 | * Return's the path to the Magento file with the environment configuration. |
||
285 | * |
||
286 | * @param string $dir The path to the Magento root directory |
||
287 | * |
||
288 | * @return string The path to the Magento file with the environment configuration |
||
289 | */ |
||
290 | protected function getMagentoEnv($dir) |
||
294 | |||
295 | /** |
||
296 | * Return's the requested Magento DB connction data. |
||
297 | * |
||
298 | * @param string $dir The path to the Magento root directory |
||
299 | * @param string $connectionName The connection name to return the data for |
||
300 | * |
||
301 | * @return array The connection data |
||
302 | * @throws \Exception Is thrown, if the requested DB connection is not available |
||
303 | */ |
||
304 | protected function getMagentoDbConnection($dir, $connectionName = 'default') |
||
327 | |||
328 | /** |
||
329 | * Create's and return's a new database configuration instance, initialized with |
||
330 | * the passed values. |
||
331 | * |
||
332 | * @param string $dsn The DSN to use |
||
333 | * @param string $username The username to use |
||
334 | * @param string|null $password The passed to use |
||
335 | * @param boolean $default TRUE if this should be the default connection |
||
336 | * @param string $id The ID to use |
||
337 | * |
||
338 | * @return \TechDivision\Import\Configuration\Jms\Configuration\Database The database configuration instance |
||
339 | */ |
||
340 | protected function newDatabaseConfiguration($dsn, $username = 'root', $password = null, $default = true, $id = null) |
||
365 | |||
366 | /** |
||
367 | * Create's and return's a new DSN from the passed values. |
||
368 | * |
||
369 | * @param string $host The host to use |
||
370 | * @param string $dbName The database name to use |
||
371 | * @param string $charset The charset to use |
||
372 | * |
||
373 | * @return string The DSN |
||
374 | */ |
||
375 | protected function newDsn($host, $dbName, $charset = 'utf8') |
||
379 | |||
380 | /** |
||
381 | * Return's the Magento Edition specific default libraries. Supported Magento Editions are CE or EE. |
||
382 | * |
||
383 | * @param string $magentoEdition The Magento Edition to return the libraries for |
||
384 | * |
||
385 | * @return array The Magento Edition specific default libraries |
||
386 | * @throws \Exception Is thrown, if the passed Magento Edition is NOT supported |
||
387 | */ |
||
388 | protected function getDefaultLibraries($magentoEdition) |
||
404 | |||
405 | /** |
||
406 | * Return's the entity types specific default import directory. |
||
407 | * |
||
408 | * @param string $entityTypeCode The entity type code to return the default import directory for |
||
409 | * |
||
410 | * @return string The default default import directory |
||
411 | * @throws \Exception Is thrown, if no default import directory for the passed entity type code is available |
||
412 | */ |
||
413 | protected function getDefaultDirectory($entityTypeCode) |
||
429 | |||
430 | /** |
||
431 | * Registers the configured aliases in the DI container. |
||
432 | * |
||
433 | * @param \TechDivision\Import\ConfigurationInterface $configuration The configuration with the aliases to register |
||
434 | * |
||
435 | * @return void |
||
436 | */ |
||
437 | protected function initializeAliases(ConfigurationInterface $configuration) |
||
448 | } |
||
449 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: