-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from alaa-almaliki/upgrade-v2.0.0
Upgrade to version 2.0.0
- Loading branch information
Showing
44 changed files
with
1,809 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea | ||
.DS_STORE |
22 changes: 17 additions & 5 deletions
22
Block/Adminhtml/System/Config/Form/Field/FieldArray/SubjectFieldArray.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,36 @@ | ||
<?php | ||
/** | ||
* @copyright 2018 Alaa Al-Maliki <[email protected]> | ||
* @license MIT | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Alaa\XmlFeedModel\Block\Adminhtml\System\Config\Form\Field\FieldArray; | ||
|
||
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray; | ||
|
||
/** | ||
* Class SubjectFieldArray | ||
* @package Alaa\XmlFeedModel\Block\Adminhtml\System\Config\Form\Field\FieldArray | ||
* @author Alaa Al-Maliki <[email protected]> | ||
* | ||
* @package Alaa\XmlFeedModel\Block\Adminhtml\System\Config\Form\Field\FieldArray | ||
* @author Alaa Al-Maliki <[email protected]> | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class SubjectFieldArray extends AbstractFieldArray | ||
{ | ||
/** | ||
* Prepare fields | ||
* @inheritdoc | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
* @codingStandardsIgnoreStart | ||
*/ | ||
protected function _prepareToRender() | ||
{ | ||
$this->addColumn('custom_attribute', [ 'label' => __('Custom Attribute')]); | ||
$this->addColumn('magento_attribute', [ 'label' => __('Magento Attribute')]); | ||
$this->addColumn('custom_attribute', [ 'label' => __('Custom Attribute')]); | ||
$this->_addAfter = false; | ||
parent::_prepareToRender(); | ||
} | ||
} | ||
//@codingStandardsIgnoreEnd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* @copyright 2018 Alaa Al-Maliki <[email protected]> | ||
* @license MIT | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Alaa\XmlFeedModel\Exception; | ||
|
||
/** | ||
* Class AttributeAlreadyExistsException | ||
* | ||
* @package Alaa\XmlFeedModel\Exception | ||
* @author Alaa Al-Maliki <[email protected]> | ||
*/ | ||
class AttributeAlreadyExistsException extends \Exception | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* @copyright 2018 Alaa Al-Maliki <[email protected]> | ||
* @license MIT | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Alaa\XmlFeedModel\Exception; | ||
|
||
/** | ||
* Class FileNotExistsException | ||
* | ||
* @package Alaa\XmlFeedModel\Exception | ||
* @author Alaa Al-Maliki <[email protected]> | ||
*/ | ||
class FileNotExistsException extends \Exception | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* @copyright 2018 Alaa Al-Maliki <[email protected]> | ||
* @license MIT | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Alaa\XmlFeedModel\Exception; | ||
|
||
/** | ||
* Class SubjectException | ||
* | ||
* @package Alaa\XmlFeedModel\Exception | ||
* @author Alaa Al-Maliki <[email protected]> | ||
*/ | ||
class SubjectException extends \Exception | ||
{ | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
/** | ||
* @copyright 2018 Alaa Al-Maliki <[email protected]> | ||
* @license MIT | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Alaa\XmlFeedModel\Model; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Framework\Serialize\Serializer\Json; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
/** | ||
* Class MappedKeys | ||
* | ||
* @package Alaa\XmlFeedModel\Model | ||
* @author Alaa Al-Maliki <[email protected]> | ||
*/ | ||
class MappedKeys implements MappedKeysInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $xmlPath; | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
protected $scopeConfig; | ||
|
||
/** | ||
* @var Json | ||
*/ | ||
protected $serializer; | ||
|
||
/** | ||
* XmlPathValue constructor. | ||
* | ||
* @param string $xmlPath | ||
* @param ScopeConfigInterface $scopeConfig | ||
* @param Json $serializer | ||
*/ | ||
public function __construct( | ||
string $xmlPath, | ||
ScopeConfigInterface $scopeConfig, | ||
Json $serializer | ||
) { | ||
$this->xmlPath = $xmlPath; | ||
$this->scopeConfig = $scopeConfig; | ||
$this->serializer = $serializer; | ||
} | ||
|
||
/** | ||
* @param null $store | ||
* @return array | ||
*/ | ||
public function getMappedKeys($store = null): array | ||
{ | ||
if (!!$this->xmlPath === false) { | ||
return []; | ||
} | ||
|
||
$value = (string) $this->scopeConfig | ||
->getValue($this->xmlPath, ScopeInterface::SCOPE_STORE, $store); | ||
$mappedKeys = []; | ||
foreach ($this->serializer->unserialize($value) as $serializedValue) { | ||
$mappedKeys[$serializedValue['magento_attribute']] = $serializedValue['custom_attribute']; | ||
} | ||
|
||
return $mappedKeys; | ||
} | ||
} |
Oops, something went wrong.