webfactory / content-mapping-destinationadapter-solarium-bundle
Installs: 13 818
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 7
Forks: 1
Open Issues: 0
pkg:composer/webfactory/content-mapping-destinationadapter-solarium-bundle
Requires
- php: >= 8.1
- nelmio/solarium-bundle: ^5.0
- psr/log: ^1.0|^2.0|^3.0
- solarium/solarium: ^6.0
- symfony/config: ^6.4|^7.0
- symfony/console: ^6.4|^7.0
- symfony/dependency-injection: ^6.4|^7.0
- symfony/http-kernel: ^6.4|^7.0
- webfactory/content-mapping-destinationadapter-solarium: ^1.2.0
README
Symfony bundle for webfactory/content-mapping-destinationadapter-solarium, easing your synchronization life via simple configuration, a services and a console command.
Installation
Install the package via composer:
composer require webfactory/content-mapping-destinationadapter-solarium-bundle
and register two bundles in your Symfony Kernel:
Webfactory\ContentMappingDestinationAdapterSolariumBundle\WebfactoryContentMappingDestinationAdapterSolariumBundleNelmio\SolariumBundle\NelmioSolariumBundle
Also, configure the endpoint for the Solarium client. Currently, only the default client with the default endpoint is supported.
// app/config.yml nelmio_solarium: endpoints: default: host: localhost port: 8983 core: your-core
Usage
The bundle provides a service called contentmapping.destinationadapter.solarium which you can use to define a
Synchronizer service inside the webfactory/content-mapping mini
framework:
<?php # Resources/config/services.php return static function(ContainerConfigurator $container) { $services = $container->services(); $services->set('my_entity_synchronizer', \Webfactory\ContentMapping\Synchronizer::class) ->args([ inline_service('Webfactory\ContentMapping\SourceAdapter\Doctrine\GenericDoctrineSourceAdapter') ->args([ inline_service('MyVendor\MyBundle\Entity\MyEntityRepository'), 'findForSolrIndex', ]), inline_service('MyVendor\MyBundle\ContentMapping\MyEntityMapper'), service('contentmapping.destinationadapter.solarium'), service('logger'), ]) ->tag('monolog.logger', ['channel' => 'solr']) ->tag('contentmapping.synchronizer', ['objectclass' => 'my-object-class']); // other synchronizers here };
As a bonus, this bundle provides you with a console command for deleting data from the solr index matching a query:
app/bin content-mapping:solarium:delete-from-index [query=*:*]
Credits, Copyright and License
This project was started at webfactory GmbH, Bonn.
Copyright 2015-2025 webfactory GmbH, Bonn. Code released under the MIT license.