forked from oroinc/crm
-
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 #1725 from laboro/fix/CRM-2961
CRM-2961: Improve Magento Region connector
- Loading branch information
Showing
12 changed files
with
134 additions
and
13 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
37 changes: 37 additions & 0 deletions
37
src/OroCRM/Bundle/MagentoBundle/Migrations/Data/ORM/UpdateConnectors.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace OroCRM\Bundle\MagentoBundle\Migrations\Data\ORM; | ||
|
||
use Doctrine\Common\DataFixtures\AbstractFixture; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
|
||
use Oro\Bundle\IntegrationBundle\Entity\Channel; | ||
use OroCRM\Bundle\MagentoBundle\Provider\ChannelType; | ||
use OroCRM\Bundle\MagentoBundle\Provider\Connector\DictionaryConnectorInterface; | ||
|
||
class UpdateConnectors extends AbstractFixture | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function load(ObjectManager $manager) | ||
{ | ||
/** @var Channel[] $channels */ | ||
$channels = $manager->getRepository('OroIntegrationBundle:Channel')->findBy(['type' => ChannelType::TYPE]); | ||
|
||
foreach ($channels as $channel) { | ||
$connectors = $channel->getConnectors(); | ||
$key = array_search('region', $connectors, true); | ||
|
||
if ($key === false) { | ||
$connectors[] = 'region' . DictionaryConnectorInterface::DICTIONARY_CONNECTOR_SUFFIX; | ||
} else { | ||
$connectors[$key] = 'region' . DictionaryConnectorInterface::DICTIONARY_CONNECTOR_SUFFIX; | ||
} | ||
|
||
$channel->setConnectors($connectors); | ||
} | ||
|
||
$manager->flush($channels); | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
|
||
interface DictionaryConnectorInterface | ||
{ | ||
const DICTIONARY_CONNECTOR_SUFFIX = '_dictionary'; | ||
} |
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
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
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
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
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
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
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
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