2017 © Pedro Peláez
 

library content-mapping-bundle

Symfony2 bundle for webfactory/content-mapping.

image

webfactory/content-mapping-bundle

Symfony2 bundle for webfactory/content-mapping.

  • Wednesday, May 11, 2016
  • by webfactory
  • Repository
  • 10 Watchers
  • 0 Stars
  • 544 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 28 % Grown

The README.md

content-mapping-bundle

Symfony bundle for webfactory/content-mapping. If you configure your Synchronizers as services, you can use the provided console commands to list and start them. This is useful e.g. for cronjobs., (*1)

Installation

Install the package via composer, (*2)

composer require webfactory/content-mapping-bundle

and enable the bundle in your app kernel:, (*3)

<?php
// app/AppKernel.php

public function registerBundles()
{
    // ...
    $bundles[] = new Webfactory\ContentMappingBundle\WebfactoryContentMappingBundle();
    // ...
}

Usage

First, register your Synchronizers as a service, e.g. in your services.xml:, (*4)


<service class="Webfactory\ContentMapping\Synchronizer">
    <!-- SourceAdapter -->
    <argument type="service">
        <service class="Webfactory\ContentMapping\SourceAdapter\Doctrine\GenericDoctrineSourceAdapter">
            <!-- Doctrine Repository -->
            <argument type="service">
                <service class="MyVendor\MyBundle\Entity\MyEntityRepository" factory-service="doctrine.orm.entity_manager" factory-method="getRepository">
                    <argument>MyVendorMyEntityBundle:MyEntity</argument>
                </service>
            </argument>
            <!-- Name of the repository method to query -->
            <argument type="string">findForSolrIndex</argument>
        </service>
    </argument>

    <!-- Mapper -->
    <argument type="service">
        <service class="MyVendor\MyBundle\ContentMapping\MyEntityMapper" />
    </argument>

    <!-- DestinationAdapter -->
    <argument type="service" id="contentmapping.destinationadapter.solarium"/>

    <!-- PSR3-logger -->
    <argument type="service" id="logger" />
    <tag name="monolog.logger" channel="solr" />

    <!-- Tag to mark the service as a Synchronizer -->
    <tag name="contentmapping.synchronizer" objectclass="\JugendFuerEuropa\Bundle\JugendInAktionBundle\Entity\Mitarbeiter" />
</service>


If you've tagged your service as in the example above, you can use the console command, (*5)

app/console content-mapping:list-synchronizers

to list your registered synchronizers denoted by their objectclass, and, (*6)

app/console content-mapping:synchronize

to start them. Use -o objectclass to start only the Synchronizer for the objectclass and -f to force updates in the destination systems even if no changes are detected. Be aware that objectclass is not the name of your entity class you'd like to synchronize, but the value you defined in the service definition (see above). Note that backslashes in your objectclass need to be escaped (with backslashes)., (*7)

This project was started at webfactory GmbH, Bonn., (*8)

Copyright 2015-2022 webfactory GmbH, Bonn. Code released under the MIT license., (*9)

The Versions

11/05 2016

dev-commands-log-to-console

dev-commands-log-to-console

Symfony2 bundle for webfactory/content-mapping.

  Sources   Download

MIT

The Requires

 

09/05 2016

dev-master

9999999-dev

Symfony2 bundle for webfactory/content-mapping.

  Sources   Download

MIT

The Requires

 

09/05 2016

1.0.0

1.0.0.0

Symfony2 bundle for webfactory/content-mapping.

  Sources   Download

MIT

The Requires