@@ -256,7 +256,7 @@ routing configuration to enable the REST end point for saving content:
256
256
$collection->addCollection($loader->import("@CmfCreateBundle/Resources/config/routing/rest.xml"));
257
257
258
258
return $collection;
259
-
259
+
260
260
.. tip ::
261
261
262
262
If you don't want these routes to be prefixed by the current locale, you can
@@ -515,36 +515,41 @@ domain objects. Data needs to be stored back into the database.
515
515
The chain mapper and ORM configuration was introduced in CreateBundle
516
516
1.3. Prior, only the PHPCR-ODM mapper was available.
517
517
518
+ Adding Custom Mappers to the Chain
519
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
520
+
518
521
The CreateBundle provides a chain mapper service that supports multiple mappers.
519
522
Mappers for Doctrine PHPCR-ODM and Doctrine ORM are provided and can be enabled
520
523
via :ref: `persistence configuration <config-create-persistence >`.
521
524
522
- You may provide mappers to the chain mapper in addition to or in place of the
523
- provided mappers. They must implement ``Midgard\CreatePHP\RdfChainableMapperInterface ``
524
- and be tagged with ``create_cmf.mapper ``.
525
+ You may provide mappers to the chain mapper in addition to or in place of
526
+ the provided mappers. They must implement ``Midgard\CreatePHP\RdfChainableMapperInterface ``
527
+ and be tagged with ``create_cmf.mapper ``. You may provide the tag with an
528
+ alias which will be prepended to subjects, the RDFa about field. If an alias
529
+ is not provided, the service's id will be used instead.
525
530
526
531
.. configuration-block ::
527
532
528
533
.. code-block :: yaml
529
534
530
535
services :
531
- acme_core.my_mapper :
532
- class : " %my_namespace.my_mapper_class% "
536
+ app.elasticsearch_mapper :
537
+ class : " AppBundle \M apper \E lasticSearchMapper "
533
538
tags :
534
- - { name: create_cmf.mapper, alias: my_mapper_alias }
539
+ - { name: create_cmf.mapper, alias: elasticsearch }
535
540
536
541
.. code-block :: xml
537
542
538
- <service id =" acme_core.my_mapper " class =" %my_namespace.my_mapper_class% " >
539
- <tag name =" create_cmf.mapper" alias =" my_mapper_alias " />
543
+ <service id =" app.elasticsearch_mapper " class =" AppBundle\Mapper\ElasticSearchMapper " >
544
+ <tag name =" create_cmf.mapper" alias =" elasticsearch " />
540
545
<!-- ... -->
541
546
</service >
542
547
543
548
.. code-block :: php
544
549
545
550
$container
546
- ->register('acme_core.my_mapper ', '%my_namespace.my_mapper_class ')
547
- ->addTag('create_cmf.mapper', array('alias' => 'my_mapper_alias '))
551
+ ->register('app.elasticsearch_mapper ', 'AppBundle\Mapper\ElasticSearchMapper ')
552
+ ->addTag('create_cmf.mapper', array('alias' => 'elasticsearch '))
548
553
;
549
554
550
555
You may instead set :ref: `config-create-object-mapper-service-id ` and use
0 commit comments