Installation

Requirements

The only requirements to get this connector working are:

  • make sure you have access to the API integrations keys.
  • make sure that the ACL permissions on these keys are setup correctly - provide full API access
  • make sure that RabbitMQ is active on the Magento environment and that the consumers are configured / automated. Magento needs to be running at version 2.3 at least.
  • make sure to take your time to read this documentation ;)

Installation guide

Composer

First add the private repository to your composer.json

"repositories": [
    {
      "type": "composer",
      "url": "satis.induxx.be"
    }
]

Install the package with composer

composer require induxx/akeneo-magento-api-bundle
Project commands

Add the following scripts to your composer.json file of your PIM project. Extend the Akeneo commands. These commands are necessary for moving the migration files to the correct migration directory.

    "scripts": {
        "post-update-cmd": [
            "bash vendor/akeneo/pim-community-dev/std-build/install-required-files.sh",
            "bash vendor/induxx/akeneo-magento-api-bundle/std-build/install-required-files.sh"
        ],
        "post-install-cmd": [
            "bash vendor/akeneo/pim-community-dev/std-build/install-required-files.sh",
            "bash vendor/induxx/akeneo-magento-api-bundle/std-build/install-required-files.sh"
        ],
        "post-create-project-cmd": [
            "bash vendor/akeneo/pim-community-dev/std-build/install-required-files.sh",
            "bash vendor/induxx/akeneo-magento-api-bundle/std-build/install-required-files.sh"
        ]
    }
Bundle commands

Extra information. The follow composer commands are available in the bundle itself.

"scripts": {
    "test": [
      "vendor/bin/phpunit",
      "vendor/bin/phpspec run"
    ],
    "phpstan": [
      "vendor/bin/phpstan analyse src"
    ],
    "csfixer": [
      "tools/cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --config .php_cs.dist.php"
    ],
    "clearCache": "rm -rf var/cache/*"
  }
Bundles

Register these bundles in your config/bundles.php file

Induxx\Bundle\CredentialsManagerBundle\InduxxCredentialsManagerBundle::class => ['all' => true],
Induxx\Bundle\EventsBundle\InduxxEventsBundle::class => ['all' => true],
Induxx\Bundle\MagentoBundle\MagentoBundle::class => ['all' => true]
Routing

Add the necessary routing in your projects config/routes/magento_connector.yml and credentials_manager.yml files

magento_connector:
    resource: "@MagentoBundle/Resources/config/routing.yml"
    
------------------

induxx_credentials_manager:
    resource: "@InduxxCredentialsManagerBundle/Resources/config/routing.yml"
    prefix:   /induxx/
Services.yml

Add the kernel_secrets_dir parameter to your config/services/services.yml file

    parameters:
        kernel_secrets_dir: '%kernel.project_dir%/config/secrets'

Add the EventTransportFactory services. This one is needed for the events bundle (introduced in 5.3.0).

services:
    Induxx\Bundle\EventsBundle\Transport\EventTransportFactory:
        arguments:
            - '@induxx_bundle_events.repository.event_message_repository'
        tags: [ messenger.transport_factory ]

Enable or extend logging in the config/packages/monolog.yml file

# Currently logs all requests, 
# we prefer to log just the api requests
monolog:
    handlers:
        magento_api_client:
            type:     stream
            path:     "%kernel.logs_dir%/magento_api_client/%kernel.environment%.log"
            level:    critical
            channels: [magento_api_client]
    channels: ['magento_api_client' ]
Akeneo enterprise functionality

For EE projects add the following code to your config/services/services.yml file.

imports:
    # add when using EE
    - { resource: '@MagentoBundle/Resources/config/ee_services.yml' }
Projects with reference data

For projects with custom reference data add the following code to your config/services/services.yml file. See the topic “references” for more information.

imports:
    # add when using reference data
    - { resource: '@MagentoBundle/Resources/config/reference_data.yml' }
Messenger.yml

Add the following code to your config/packages/messenger.yml file. We need this for the events bundle.

framework:
    messenger:
        transports:
            induxx_event_queue:
                dsn: induxx-transport://default
                options:
                    table_name: messenger_messages
                    queue_name: default
                    redeliver_timeout: 3600
                    auto_setup: false
                serializer: pim_enrich.messenger.serializer.business_event

        routing:
            'Induxx\Bundle\EventsBundle\Model\EventMessage': induxx_event_queue
Migration scripts

The migration files should be installed automatically after running the composer install and update commands. If these are not in place you can rerun the following command.

bash vendor/induxx/akeneo-magento-api-bundle/std-build/install-required-files.sh

Check the migration status by running the following command.

bin/console doctrine:migrations:status

If your migration versions are not up to date you can run the migration script by the following command.

bin/console doctrine:migrations:migrate