allies/oro-extended-magento-bundle
Installation:
composer require allies/oro-extended-magento-bundle
Ensure your project uses oro/crm: ~2.0 (not 2.3+ due to incompatibility).
Enable the Bundle:
Add to config/bundles.php:
return [
// ...
Allies\ExtendedMagentoBundle\AlliesExtendedMagentoBundle::class => ['all' => true],
];
Prerequisites:
oro/crm-magento-bundle (e.g., API credentials, sync settings).First Use Case: Sync Magento customer data to OroCRM with extended fields (e.g., gender, custom attributes) via:
php bin/console oro:cron:run --emulate
Verify extended fields in OroCRM’s magento_customer entity.
Field Extension:
Customer, Order) in config/oro/magento.yml:
oro_magento:
entities:
customer:
fields:
gender: ~ # Maps Magento's gender to OroCRM's extended field
AlliesExtendedMagentoBundle's event listeners (e.g., CustomerGenderConverter) to transform data.Sync Automation:
php bin/console oro:cron:run --emulate --env=prod
var/log/oro/magento_sync.log.Custom Attributes:
eav_attribute data via OroCRM’s magento_attribute entity.loyalty_points to sync from Magento:
// src/EventListener/MagentoAttributeSubscriber.php
use Allies\ExtendedMagentoBundle\Event\MagentoAttributeEvent;
class MagentoAttributeSubscriber {
public function onLoadAttributes(MagentoAttributeEvent $event) {
$event->addAttribute('loyalty_points', 'text');
}
}
Data Validation:
# config/validation.yml
Oro\MagentoBundle\Entity\Customer:
properties:
gender:
- NotBlank: ~
- Choice: { choices: ["male", "female", "other"] }
oro_magento.yml).oro:magento:entity:dump to inspect current mappings:
php bin/console oro:magento:entity:dump
$this->get('oro_magento.api.client')->method('getCustomer')->willReturn($mockCustomer);
Version Lock:
ClassNotFoundException for Allies\ExtendedMagentoBundle\....oro/crm: ~2.0 (not 2.3+) and allies/oro-extended-magento-bundle: ~2.0 in composer.json.Gender Conversion Bug:
null or incorrect values (fixed in 2.0.1).CustomerGenderConverter if using an older version:
// src/Allies/ExtendedMagentoBundle/Converter/CustomerGenderConverter.php
public function convert($gender) {
return in_array($gender, [1, 2, 3]) ? ['male', 'female', 'other'][$gender - 1] : null;
}
Missing Extended Fields:
oro_magento.yml or Magento API.var/log/oro/magento_sync.log for skipped fields.Cron Conflicts:
.env:
ORO_CRON_TIMEOUT=3600
php bin/console oro:magento:sync --env=prod --verbose
$this->get('doctrine')->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
Custom Sync Logic:
Subscribe to oro_magento.sync.post event:
// src/EventListener/CustomSyncListener.php
use Oro\Bundle\MagentoBundle\Event\SyncEvent;
class CustomSyncListener {
public function onPostSync(SyncEvent $event) {
$entity = $event->getEntity();
// Add custom logic (e.g., update related records)
}
}
New Entity Support:
Extend for non-customer entities (e.g., Product, Quote) by:
MagentoEntityInterface for new entities.API Client Overrides: Replace the default Magento API client:
# config/services.yaml
services:
oro_magento.api.client:
class: App\Service\CustomMagentoClient
arguments:
- '@oro_magento.api.client.default'
first_name), but Magento uses camelCase (firstName). Use oro_magento.yml to normalize:
oro_magento:
entities:
customer:
fields:
first_name: firstName
oro_magento.yml:
oro_magento:
timezone: America/New_York
How can I help you explore Laravel packages today?