Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 08e030b

Browse files
committed
More concrete examples and slightly more self-contained documentation
1 parent 1190ee6 commit 08e030b

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

bundles/create/configuration.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ For more information, see the
7272
You can specify a service implementing ``Midgard\CreatePHP\RdfMapperInterface``
7373
that will handle objects that need to be stored by the REST handler of
7474
CreatePHP. You need to either specify this service, enable phpcr or orm
75-
persistence or provide a ``cmf_create.mapper`` tagged mapper for this
76-
bundle to work.
75+
persistence or define one or more services that implement the
76+
``Midgard\CreatePHP\RdfChainableMapperInterface`` and tag them with ``cmf_create.mapper``.
7777

7878
.. _config-create-persistence:
7979

8080
``persistence``
8181
~~~~~~~~~~~~~~~
8282

83-
This defines the persistence driver and associated classes. The default
84-
persistence configuration has the following configurations.
83+
This defines a persistence driver for Doctrine PHPCR-ODM documents or Doctrine ORM entities.
84+
If you specify neither, see :ref:`config-create-object-mapper-service-id`.
8585

8686
``phpcr``
8787
.........
@@ -91,7 +91,6 @@ persistence configuration has the following configurations.
9191
.. code-block:: yaml
9292
9393
cmf_create:
94-
object_mapper_service_id: ~
9594
persistence:
9695
phpcr:
9796
enabled: false
@@ -181,7 +180,6 @@ your content is gone.
181180
.. code-block:: yaml
182181
183182
cmf_create:
184-
object_mapper_service_id: ~
185183
persistence:
186184
orm:
187185
enabled: false

bundles/create/introduction.rst

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ routing configuration to enable the REST end point for saving content:
256256
$collection->addCollection($loader->import("@CmfCreateBundle/Resources/config/routing/rest.xml"));
257257
258258
return $collection;
259-
259+
260260
.. tip::
261261

262262
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.
515515
The chain mapper and ORM configuration was introduced in CreateBundle
516516
1.3. Prior, only the PHPCR-ODM mapper was available.
517517

518+
Adding Custom Mappers to the Chain
519+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
520+
518521
The CreateBundle provides a chain mapper service that supports multiple mappers.
519522
Mappers for Doctrine PHPCR-ODM and Doctrine ORM are provided and can be enabled
520523
via :ref:`persistence configuration <config-create-persistence>`.
521524

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.
525530

526531
.. configuration-block::
527532

528533
.. code-block:: yaml
529534
530535
services:
531-
acme_core.my_mapper:
532-
class: "%my_namespace.my_mapper_class%"
536+
app.elasticsearch_mapper:
537+
class: "AppBundle\Mapper\ElasticSearchMapper"
533538
tags:
534-
- { name: create_cmf.mapper, alias: my_mapper_alias }
539+
- { name: create_cmf.mapper, alias: elasticsearch }
535540
536541
.. code-block:: xml
537542
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" />
540545
<!-- ... -->
541546
</service>
542547
543548
.. code-block:: php
544549
545550
$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'))
548553
;
549554
550555
You may instead set :ref:`config-create-object-mapper-service-id` and use

0 commit comments

Comments
 (0)