Skip to content
This repository
Browse code

adding doc on phpcr-odm bundle and lots of cleanup

  • Loading branch information...
commit 1fd2ef672d35d304344c2505609bc5617380142e 1 parent bb8dabe
David Buchmann dbu authored
2  index.rst
Source Rendered
@@ -38,8 +38,10 @@ to do it? The reference is the right place to search.
38 38 reference/routing-extra
39 39 reference/routing
40 40 reference/search
  41 + reference/simple-cms
41 42 reference/tree
42 43 reference/tree-browser
  44 + reference/phpcr-odm
43 45
44 46 .. _`Document planning`: https://github.com/symfony-cmf/symfony-cmf/wiki/Documentation-Planning
45 47 .. _`CMF website`: http://cmf.symfony.com/get-involved
33 reference/block.rst
Source Rendered
... ... @@ -1,16 +1,17 @@
1   -SymfonyCmfBlockBundle
2   -=====================
3   -
4   -The `SymfonyCmfBlockBundle <https://github.com/symfony-cmf/BlockBundle#readme>`_ provides integration with SonataBlockBundle.
5   -
6   -.. index:: BlockBundle
7   -
8   -Dependencies
9   -------------
10   -
11   -* `SonataBlockBundle <https://github.com/sonata-project/SonataBlockBundle#readme>`_
12   -
13   -Configuration
14   --------------
15   -
16   -The configuration key for this bundle is ``symfony_cmf_block``
  1 +SymfonyCmfBlockBundle
  2 +=====================
  3 +
  4 +The `SymfonyCmfBlockBundle <https://github.com/symfony-cmf/BlockBundle#readme>`_ provides integration with SonataBlockBundle.
  5 +
  6 +.. index:: BlockBundle
  7 +
  8 +Dependencies
  9 +------------
  10 +
  11 +This bundle is based on the `SonataBlockBundle <https://github.com/sonata-project/SonataBlockBundle#readme>`_
  12 +
  13 +
  14 +Configuration
  15 +-------------
  16 +
  17 +The configuration key for this bundle is ``symfony_cmf_block``
49 reference/create.rst
Source Rendered
@@ -105,10 +105,9 @@ image location.
105 105 Configuration
106 106 -------------
107 107
108   -Add the settings to the ``app/config/config.yml``:
109   -
110 108 .. code-block:: yaml
111 109
  110 + # app/config/config.yml
112 111 symfony_cmf_create:
113 112 # metadata loading
114 113
@@ -160,7 +159,7 @@ default IS_AUTHENTICATED_ANONYMOUSLY to the bundle.
160 159 If you specify a different role, create.js will only be loaded if the user has that role
161 160 and the REST handler (and image handler if enabled) will check the role.
162 161
163   -If you need more fine grained access control, look into the mapper `isEditable` method.
  162 +If you need more fine grained access control, look into the mapper ``isEditable`` method.
164 163 You can extend the mapper you use and overwrite isEditable to answer whether the
165 164 passed domain object is editable.
166 165
@@ -230,14 +229,14 @@ Usage
230 229
231 230 Adjust your template to load the editor js files if the current session is allowed to edit content.
232 231
233   -::
  232 +.. code-block:: jinja
234 233
235 234 {% render "symfony_cmf_create.jsloader.controller:includeJSFilesAction" %}
236 235
237 236 Plus make sure that assetic is rewriting paths in your css files, then include
238 237 the base css files (and customize with your css as needed) with
239 238
240   -::
  239 +.. code-block:: jinja
241 240
242 241 {% include "SymfonyCmfCreateBundle::includecssfiles.html.twig" %}
243 242
@@ -254,7 +253,7 @@ For an example mapping see the files in the cmf-sandbox. Reference documentation
254 253
255 254 To render your model, use the createphp twig tag:
256 255
257   -.. code-block:: html
  256 +.. code-block:: html+jinja
258 257
259 258 {% createphp page as="rdf" %}
260 259 {{ rdf|raw }}
@@ -262,7 +261,7 @@ To render your model, use the createphp twig tag:
262 261
263 262 Or if you need more control over the generated HTML:
264 263
265   -.. code-block:: html
  264 +.. code-block:: html+jinja
266 265
267 266 {% createphp page as="rdf" %}
268 267 <div {{ createphp_attributes(rdf) }}>
@@ -280,6 +279,8 @@ version of hallo that is bundled with create is used. To develop the actual code
280 279 you will need to checkout the full hallo repository first. You can do this by running
281 280 the following commenad from the command line:
282 281
  282 +.. code-block:: bash
  283 +
283 284 app/console cmf:create:init-hallo-devel
284 285
285 286 Then, set the ``symfony_cmf_create > use_coffee`` option to true in config.yml. This tells the
@@ -289,19 +290,21 @@ javascript from ``Resources/public/vendor/create/deps/hallo-min.js``.
289 290 This also means that you need to add a mapping for coffeescript in your assetic
290 291 configuration and you need the `coffee compiler set up correctly <http://coffeescript.org/#installation>`_.
291 292
292   -.. code-block:: yaml
  293 +.. configuration-block::
293 294
294   - assetic:
295   - filters:
296   - cssrewrite: ~
297   - coffee:
298   - bin: %coffee.bin%
299   - node: %coffee.node%
300   - apply_to: %coffee.extension%
  295 + .. code-block:: yaml
301 296
302   - symfony_cmf_create:
303   - # set this to true if you want to develop hallo and edit the coffee files
304   - use_coffee: true|false
  297 + assetic:
  298 + filters:
  299 + cssrewrite: ~
  300 + coffee:
  301 + bin: %coffee.bin%
  302 + node: %coffee.node%
  303 + apply_to: %coffee.extension%
  304 +
  305 + symfony_cmf_create:
  306 + # set this to true if you want to develop hallo and edit the coffee files
  307 + use_coffee: true|false
305 308
306 309 In the cmf sandbox we did a little hack to not trigger coffee script compiling.
307 310 In config.yml we make the coffee extension configurable. Now if the
@@ -312,8 +315,10 @@ installed.
312 315
313 316 The default values for the three parameters are::
314 317
315   -.. code-block:: yaml
  318 +.. configuration-block::
  319 +
  320 + .. code-block:: yaml
316 321
317   - coffee.bin: /usr/local/bin/coffee
318   - coffee.node: /usr/local/bin/node
319   - coffee.extension: \.coffee
  322 + coffee.bin: /usr/local/bin/coffee
  323 + coffee.node: /usr/local/bin/node
  324 + coffee.extension: \.coffee
221 reference/menu.rst
Source Rendered
... ... @@ -1,104 +1,117 @@
1   -SymfonyCmfMenuBundle
2   -====================
3   -
4   -The `SymfonyCmfMenuBundle <https://github.com/symfony-cmf/MenuBundle#readme>`_
5   -provides menus from a doctrine object manager with the help of KnpMenuBundle.
6   -
7   -.. index:: MenuBundle
8   -
9   -Menu entries
10   -------------
11   -
12   -Document\MenuItem defines menu entries. You can build menu items based on
13   -symfony routes, absolute or relative urls or referenceable phpcr-odm content
14   -documents.
15   -
16   -The menu tree is built from documents under [menu_basepath]/[menuname]. To
17   -prevent accidentally exposing nodes, only nodes ending on -item are considered
18   -menu items.
19   -You can use different document classes for menu items, as long as they implement
20   -Knp\Menu\NodeInterface to integrate with KnpMenuBundle.
21   -
22   -The currently highlighted entry is determined by checking if the content
23   -associated with a menu document is the same as the content DoctrineRouter
24   -has put into the request.
25   -
26   -Until we have a decent tutorial, you can look into the `cmf-sandbox <https://github.com/symfony-cmf/cmf-sandbox>`_
27   -and specifically the `menu fixtures <https://github.com/symfony-cmf/cmf-sandbox/blob/master/src/Sandbox/MainBundle/Resources/data/fixtures/030_LoadMenuData.php>`_.
28   -
29   -The `CMF website <http://cmf.symfony.com>`_ is another application using the CMF and the MenuBundle.
30   -
31   -Configuration
32   --------------
33   -::
34   -
35   - knp_menu:
36   - twig: true
37   -
38   - symfony_cmf_menu:
39   - menu_basepath: /phpcr/path/to/menutree
40   - document_manager: doctrine_phpcr.odm.default_document_manager
41   - menu_document_class: null
42   - content_url_generator: symfony_cmf_routing_extra.dynamic_router
43   - content_key: null (resolves to DoctrineRouter::CONTENT_KEY)
44   - route_name: null
45   - use_sonata_admin: auto|true|false
46   - content_basepath: /phpcr/path/to/content (used for the menu admin)
47   -
48   -If ``sonata-project/doctrine-phpcr-admin-bundle`` is added to the composer require,
49   -the MenuBundle can be used inside the SonataDoctrinePhpcrAdminBundle. But then,
50   -the SonataDoctrinePhpcrAdminBundle has to be instantiated in your application's kernel.
51   -
52   -By default, ``use_sonata_admin`` is automatically set based on whether
53   -SonataDoctrinePhpcrAdminBundle is available.
54   -
55   -Usage
56   ------
57   -
58   -Adjust your twig template to load the menu.
59   -
60   - {{ knp_menu_render('simple') }}
61   -
62   -
63   -The menu name is the name of the node under ``menu_basepath``. For example if your
64   -repository stores the menu nodes under ``/cms/menu`` , rendering "main" would mean
65   -to render the menu that is at ``/cms/menu/main``
66   -
67   -
68   -How to use non-default other components
69   ----------------------------------------
70   -
71   -If you use the cmf menu with phpcr-odm, you just need to store Route documents
72   -unter ``menu_basepath``. If you use a different object manager, you need to
73   -make sure that the route root document is found with
74   -
75   - $dm->find(route_document_class, menu_basepath . menu_name)
76   -
77   -The route document must implement ``Knp\Menu\NodeInterface`` - see
78   -Document/MenuItem.php for an example. You probably need to specify
79   -menu_document_class too, as only phpcr-odm can determine the document from the
80   -database content.
81   -
82   -If you use the cmf menu with the DoctrineRouter, you need no route name as the
83   -menu document just needs to provide a field content_key in the options.
84   -If you want to use a different service to generate URLs, you need to make sure
85   -your menu entries provide information in your selected content_key that the url
86   -generator can use to generate the url. Depending on your generator, you might
87   -need to specify a route_name too.
88   -Note that if you just want to generate normal symfony routes with a menu that
89   -is in the database, you can pass the core router service as content_url_generator,
90   -make sure the content_key never matches and make your menu documents provide
91   -the route name and eventual routeParameters.
92   -
93   -
94   -Dependencies
95   -------------
96   -
97   -* KnpMenuBundle
98   -
99   -Unless you change defaults and provide your own implementations, also depends on
100   -
101   -* SymfonyRoutingExtraBundle for the doctrine router service symfony_cmf_chain_routing.doctrine_router
102   - Note that you need to explicitly enable the doctrine router as per default it is not loaded.
103   - See the documentation of the routing extra bundle for how to do this.
104   -* Doctrine PHPCR-ODM to load route documents from the content repository
  1 +SymfonyCmfMenuBundle
  2 +====================
  3 +
  4 +The `SymfonyCmfMenuBundle <https://github.com/symfony-cmf/MenuBundle#readme>`_
  5 +provides menus from a doctrine object manager with the help of KnpMenuBundle.
  6 +
  7 +.. index:: MenuBundle
  8 +
  9 +
  10 +Menu entries
  11 +------------
  12 +
  13 +Document\MenuItem defines menu entries. You can build menu items based on
  14 +symfony routes, absolute or relative urls or referenceable phpcr-odm content
  15 +documents.
  16 +
  17 +The menu tree is built from documents under [menu_basepath]/[menuname]. You can
  18 +use different document classes for menu items, as long as they implement
  19 +``Knp\Menu\NodeInterface`` to integrate with KnpMenuBundle. The default MenuItem
  20 +Document discards children that do not implement this interface.
  21 +
  22 +The currently highlighted entry is determined by checking if the content
  23 +associated with a menu document is the same as the content the DynamicRouter
  24 +has put into the request.
  25 +
  26 +Setup
  27 +-----
  28 +
  29 +See `/tutorials/installing-configuring-cmf`.
  30 +
  31 +Configuration
  32 +-------------
  33 +
  34 +If you want to use default configurations, you do not need to change anything.
  35 +The values are:
  36 +
  37 +.. configuration-block::
  38 +
  39 + .. code-block:: yaml
  40 +
  41 + symfony_cmf_menu:
  42 + menu_basepath: /cms/menu
  43 + document_manager: default
  44 + menu_document_class: ~ # autodetected from stored content
  45 + content_url_generator: router
  46 + content_key: ~ # (resolves to DynamicRouter::CONTENT_KEY)
  47 + route_name: ~ # cmf routes are created by content instead of name
  48 + use_sonata_admin: auto # use true/false to force using / not using sonata admin
  49 + content_basepath: ~ # defaults to symfony_cmf_core.content_basepath
  50 +
  51 +If you want to render the menu from twig, make sure you have not disabled twig
  52 +in the ``knp_menu`` configuration section.
  53 +
  54 +If ``sonata-project/doctrine-phpcr-admin-bundle`` is added to the composer.json
  55 +require section, the MenuBundle can be used inside the SonataDoctrinePhpcrAdminBundle.
  56 +Don't forget to instantiate ``SonataDoctrinePhpcrAdminBundle`` in your kernel in
  57 +this case.
  58 +
  59 +By default, ``use_sonata_admin`` is automatically set based on whether
  60 +SonataDoctrinePhpcrAdminBundle is available but you can explicitly disable it
  61 +to not have it even if sonata is enabled, or explicitly enable to get an error
  62 +if sonata becomes unavailable.
  63 +
  64 +
  65 +Usage
  66 +-----
  67 +
  68 +Adjust your twig template to load the menu.
  69 +
  70 +.. code-block:: jinja
  71 +
  72 + {{ knp_menu_render('simple') }}
  73 +
  74 +The menu name is the name of the node under ``menu_basepath``. For example if your
  75 +repository stores the menu nodes under ``/cms/menu`` , rendering "main" would mean
  76 +to render the menu that is at ``/cms/menu/main``
  77 +
  78 +
  79 +How to use non-default other components
  80 +---------------------------------------
  81 +
  82 +If you use the cmf menu with phpcr-odm, you just need to store Route documents
  83 +untdr ``menu_basepath``. If you use a different object manager, you need to
  84 +make sure that the menu root document is found with
  85 +
  86 +.. code-block:: php
  87 +
  88 + $dm->find($menu_document_class, $menu_basepath . $menu_name)
  89 +
  90 +The route document must implement ``Knp\Menu\NodeInterface`` - see
  91 +Document/MenuItem.php for an example. You probably need to specify
  92 +menu_document_class too, as only phpcr-odm can determine the document from the
  93 +database content.
  94 +
  95 +If you use the cmf menu with the DynamicRouter, you need no route name as the
  96 +menu document just needs to provide a field content_key in the options.
  97 +If you want to use a different service to generate URLs, you need to make sure
  98 +your menu entries provide information in your selected content_key that the url
  99 +generator can use to generate the url. Depending on your generator, you might
  100 +need to specify a route_name too.
  101 +Note that if you just want to generate normal symfony routes with a menu that
  102 +is in the database, you can pass the core router service as content_url_generator,
  103 +make sure the content_key never matches and make your menu documents provide
  104 +the route name and eventual routeParameters.
  105 +
  106 +
  107 +Dependencies
  108 +------------
  109 +
  110 +This bundle is extending the `KnpMenuBundle <https://github.com/knplabs/KnpMenuBundle>`_.
  111 +
  112 +Unless you change defaults and provide your own implementations, this bundle also depends on
  113 +
  114 +* ``SymfonyRoutingExtraBundle`` for the router service ``symfony_cmf_routing_extra.dynamic_router``.
  115 + Note that you need to explicitly enable the dynamic router as per default it is not loaded.
  116 + See the :doc:`documentation of the routing extra bundle</reference/routing-extra>` for how to do this.
  117 +* :doc:`/reference/phpcr-odm` to load route documents from the content repository
363 reference/phpcr-odm.rst
Source Rendered
... ... @@ -0,0 +1,363 @@
  1 +DoctrinePHPCRBundle
  2 +===================
  3 +
  4 +The `DoctrinePHPCRBundle <https://github.com/doctrine/phpcr-bundle>`_
  5 +provides integration with the PHP content repository and optionally with
  6 +Doctrine PHPCR ODM to provide the ODM document manager in symfony.
  7 +
  8 +.. index:: DoctrinePHPCRBundle
  9 +
  10 +.. Tip::
  11 +
  12 + This reference only explains the Symfony2 integration of PHPCR and PHPCR-ODM.
  13 + To learn how to use PHPCR refer to `the PHPCR website <http://phpcr.github.com/>`_ and for
  14 + Doctrine PHPCR-ODM to the `PHPCR-ODM documentation <http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/>`_.
  15 +
  16 +
  17 +Setup
  18 +-----
  19 +
  20 +See :doc:`/tutorials/installing-configuring-doctrine-phpcr-odm`
  21 +
  22 +
  23 +Configuration
  24 +-------------
  25 +
  26 +.. tip::
  27 +
  28 + If you want to only use plain PHPCR without the PHPCR-ODM, you can simply not
  29 + configure the `odm` section to avoid loading the services at all. Note that most
  30 + CMF bundles by default use PHPCR-ODM documents.
  31 +
  32 +
  33 +
  34 +PHPCR Session Configuration
  35 +~~~~~~~~~~~~~~~~~~~~~~~~~~~
  36 +
  37 +The session needs a PHPCR implementation specified in the ``backend`` section
  38 +by the ``type`` field, along with configuration options to bootstrap the
  39 +implementation. Currently we support jackrabbit, doctrinedbal and midgard2.
  40 +Regardless of the backend, every PHPCR session needs a workspace, username and
  41 +password.
  42 +
  43 +.. Tip::
  44 +
  45 + Every PHPCR implementation should provide the default workspace, but you
  46 + can choose a different one. There is the ``doctrine:phpcr:workspace:create``
  47 + command to initialize a new workspace. See also :ref:`reference-phpcr-commands`.
  48 +
  49 +This username and password are what is used on the PHPCR layer in the
  50 +``PHPCR\SimpleCredentials``. They will usually be different from the username
  51 +and password used by midgard or Doctrine DBAL to connect to the
  52 +underlying RDBMS where the data is actually stored.
  53 +
  54 +If you are using one of the Jackalope backends, you can also specify ``options``.
  55 +They will be set on the Jackalope session. Currently this can be used to tune
  56 +pre-fetching nodes by setting ``jackalope.fetch_depth`` to something bigger than
  57 +0.
  58 +
  59 +.. configuration-block::
  60 +
  61 + .. code-block:: yaml
  62 +
  63 + # app/config/config.yml
  64 + doctrine_phpcr:
  65 + session:
  66 + backend:
  67 + # see below for how to configure the backend of your choice
  68 + workspace: default
  69 + username: admin
  70 + password: admin
  71 + # options:
  72 + # key: value
  73 +
  74 +
  75 +PHPCR Session with Jackalope Jackrabbit
  76 +"""""""""""""""""""""""""""""""""""""""
  77 +
  78 +The only setup required is to install Apache Jackrabbit (see :ref:`installing Jackrabbit <tutorials-installing-phpcr-jackrabbit>`).
  79 +
  80 +.. configuration-block::
  81 +
  82 + .. code-block:: yaml
  83 +
  84 + # app/config/config.yml
  85 + doctrine_phpcr:
  86 + session:
  87 + backend:
  88 + type: jackrabbit
  89 + url: http://localhost:8080/server/
  90 +
  91 +.. _reference-phpcr-doctrinedbal:
  92 +
  93 +PHPCR Session with Jackalope Doctrine DBAL
  94 +""""""""""""""""""""""""""""""""""""""""""
  95 +
  96 +This type uses Jackalope with a Doctrine database abstraction layer transport
  97 +to provide PHPCR without any installation requirements beyond any of the RDBMS
  98 +supported by Doctrine.
  99 +
  100 +You need to configure a Doctrine connection according to the DBAL section in
  101 +the `Symfony2 Doctrine documentation <http://symfony.com/doc/current/book/doctrine.html>`_.
  102 +
  103 +.. configuration-block::
  104 +
  105 + .. code-block:: yaml
  106 +
  107 + # app/config/config.yml
  108 + doctrine_phpcr:
  109 + session:
  110 + backend:
  111 + type: doctrinedbal
  112 + connection: doctrine.dbal.default_connection
  113 +
  114 +Once the connection is configured, you can create the database and you *need*
  115 +to initialize the database with the ``doctrine:phpcr:init:dbal`` command.
  116 +
  117 +.. code-block:: bash
  118 +
  119 + app/console doctrine:database:create
  120 + app/console doctrine:phpcr:init:dbal
  121 +
  122 +.. Tip::
  123 +
  124 + Of course, you can also use a different connection instead of the default.
  125 + It is recommended to use a separate connection to a separate database if
  126 + you also use Doctrine ORM or direkt DBAL access to data, rather than mixing
  127 + this data with the tables generated by jackaleope-doctrine-dbal.
  128 + If you have a separate connection, you need to pass the alternate
  129 + connection name to the ``doctrine:database:create`` command with the
  130 + ``--connection`` option. For doctrine PHPCR commands, this parameter is not
  131 + needed as you configured the connection to use.
  132 +
  133 +
  134 +PHPCR Session with Midgard2
  135 +"""""""""""""""""""""""""""
  136 +
  137 +Midgard2 is an application that provides a compiled PHP extension. It
  138 +implements the PHPCR API on top of a standard RDBMS.
  139 +
  140 +For installation and the exact meanings and supported values in the configuration
  141 +options, see the `official Midgard PHPCR documentation <http://midgard-project.org/phpcr/>`_
  142 +
  143 +
  144 +.. configuration-block::
  145 +
  146 + .. code-block:: yaml
  147 +
  148 + # app/config/config.yml
  149 + doctrine_phpcr:
  150 + session:
  151 + backend:
  152 + type: midgard2
  153 + db_type: MySQL
  154 + db_name: midgard2_test
  155 + db_host: "0.0.0.0"
  156 + db_port: 3306
  157 + db_username: ""
  158 + db_password: ""
  159 + db_init: true
  160 + blobdir: /tmp/cmf-blobs
  161 +
  162 +
  163 +Doctrine PHPCR-ODM Configuration
  164 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  165 +
  166 +This configuration section manages the Doctrine PHPCR-ODM system. If you do not
  167 +configure anything here, the ODM services will not be loaded.
  168 +
  169 +If you enable ``auto_mapping``, you can place your mappings in
  170 +``<Bundle>/Resources/config/doctrine/<Document>.phpcr.xml`` resp. .yml to
  171 +configure mappings for documents you provide in the ``<Bundle>/Document``
  172 +folder. Otherwise you need to manually configure the mappings section.
  173 +
  174 +If ``auto_generate_proxy_classes`` is false, you need to run the ``cache:warmup``
  175 +command in order to have the proxy classes generated after you modified a
  176 +document. You can also tune how and where to generate the proxy classes with the
  177 +``proxy_dir`` and ``proxy_namespace`` settings. The the defaults are usually fine
  178 +here.
  179 +
  180 +You can also enable `metadata caching <http://symfony.com/doc/master/reference/configuration/doctrine.html>`_.
  181 +
  182 +.. configuration-block::
  183 +
  184 + .. code-block:: yaml
  185 +
  186 + # app/config/config.yml
  187 + doctrine_phpcr:
  188 + odm:
  189 + configuration_id: ~
  190 + auto_mapping: true
  191 + mappings:
  192 + <name>:
  193 + mapping: true
  194 + type: ~
  195 + dir: ~
  196 + alias: ~
  197 + prefix: ~
  198 + is_bundle: ~
  199 + auto_generate_proxy_classes: %kernel.debug%
  200 + proxy_dir: %kernel.cache_dir%/doctrine/PHPCRProxies
  201 + proxy_namespace: PHPCRProxies
  202 +
  203 + metadata_cache_driver:
  204 + type: array
  205 + host: ~
  206 + port: ~
  207 + instance_class: ~
  208 + class: ~
  209 + id: ~
  210 +
  211 +
  212 +
  213 +Translation configuration
  214 +"""""""""""""""""""""""""
  215 +
  216 +.. index:: I18N, Multilanguage
  217 +
  218 +If you are using multilingual documents, you need to configure the available
  219 +languages. For more information on multilingual documents, see the
  220 +`PHPCR-ODM documentation on Multilanguage <http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/reference/multilang.html>`_.
  221 +
  222 +.. configuration-block::
  223 +
  224 + .. code-block:: yaml
  225 +
  226 + # app/config/config.yml
  227 + doctrine_phpcr:
  228 + odm:
  229 + locales:
  230 + en:
  231 + - en
  232 + - de
  233 + de:
  234 + - de
  235 + - en
  236 +
  237 +
  238 +General Settings
  239 +~~~~~~~~~~~~~~~~
  240 +
  241 +If the `jackrabbit_jar` path is set, you can use the `doctrine:phpcr:jackrabbit`
  242 +console command to start and stop jackrabbit.
  243 +
  244 +You can tune the output of the `doctrine:phpcr:dump` command with
  245 +`dump_max_line_length`.
  246 +
  247 +.. configuration-block::
  248 +
  249 + .. code-block:: yaml
  250 +
  251 + # app/config/config.yml
  252 + doctrine_phpcr:
  253 + jackrabbit_jar: /path/to/jackrabbit.jar
  254 + dump_max_line_length: 120
  255 +
  256 +
  257 +Configuring Multiple Sessions
  258 +-----------------------------
  259 +
  260 +If you need more than one PHPCR backend, you can define ``sessions`` as child
  261 +of the ``session`` information. Each session has a name and the configuration
  262 +as you can use directly in ``session``. You can also overwrite which session
  263 +to use as ``default_session``.
  264 +
  265 +
  266 +.. configuration-block::
  267 +
  268 + .. code-block:: yaml
  269 +
  270 + # app/config/config.yml
  271 + doctrine_phpcr:
  272 + session:
  273 + default_session: ~
  274 + sessions:
  275 + <name>:
  276 + workspace: ~ # Required
  277 + username: ~
  278 + password: ~
  279 + backend:
  280 + # as above
  281 + options:
  282 + # as above
  283 +
  284 +If you are using the ODM, you will also want to configure multiple document managers.
  285 +
  286 +Inside the odm section, you can add named entries in the ``document_managers``.
  287 +
  288 +.. configuration-block::
  289 +
  290 + .. code-block:: yaml
  291 +
  292 + odm:
  293 + default_document_manager: ~
  294 + document_managers:
  295 + <name>:
  296 + # same options as directly in odm, see above.
  297 + # you want to set a different session
  298 +
  299 +
  300 +.. _reference-phpcr-commands:
  301 +
  302 +Doctrine PHPCR Commands
  303 +-----------------------
  304 +
  305 +All commands about PHPCR are prefixed with ``doctrine:phpcr`` and you can use
  306 +the --session argument to use a non-default session if you configured several
  307 +PHPCR sessions.
  308 +
  309 +Some of these commands are specific to a backend or to the ODM. Those commands
  310 +will only be available if such a backend is configured.
  311 +
  312 +Use ``app/console help <command>`` to see all options each of the commands has.
  313 +
  314 +- ``doctrine:phpcr:workspace:create`` Create a workspace in the configured repository
  315 +- ``doctrine:phpcr:workspace:list`` List all available workspaces in the configured repository
  316 +- ``doctrine:phpcr:purge`` Remove all content from the repository
  317 +- ``doctrine:phpcr:register-system-node-types`` Register system node types in the PHPCR repository
  318 +- ``doctrine:phpcr:register-node-types`` Register node types in the PHPCR repository
  319 +- ``doctrine:phpcr:fixtures:load`` Load data fixtures to your PHPCR database.
  320 +- ``doctrine:phpcr:import`` Import xml data into the repository, either in JCR system view format or arbitrary xml
  321 +- ``doctrine:phpcr:export`` Export nodes from the repository, either to the JCR system view format or the document view format
  322 +- ``doctrine:phpcr:dump`` Dump the content repository
  323 +- ``doctrine:phpcr:query`` Execute a JCR SQL2 statement
  324 +- ``doctrine:phpcr:mapping:info`` Shows basic information about all mapped documents
  325 +
  326 +
  327 +Jackrabbit specific commands
  328 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  329 +
  330 +If you are using jackalope-jackrabbit, you also have a command to start and stop the
  331 +jackrabbit server:
  332 +
  333 +- ``jackalope:run:jackrabbit`` Start and stop the Jackrabbit server
  334 +
  335 +
  336 +Doctrine DBAL specific commands
  337 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  338 +
  339 +If you are using jackalope-doctrine-dbal, you have a command to initialize the
  340 +database:
  341 +
  342 +- ``jackalope:init:dbal`` Prepare the database for Jackalope Doctrine DBAL
  343 +
  344 +Note that you can also use the doctrine dbal command to create the database.
  345 +
  346 +
  347 +Some example command runs
  348 +~~~~~~~~~~~~~~~~~~~~~~~~~
  349 +
  350 +Running `SQL2 queries <http://www.h2database.com/jcr/grammar.html>`_ against the repository
  351 +
  352 +.. code-block:: bash
  353 +
  354 + app/console doctrine:phpcr:query "SELECT title FROM [nt:unstructured] WHERE NAME() = 'home'"
  355 +
  356 +
  357 +Dumping nodes under /cms/simple including their properties
  358 +
  359 +.. code-block:: bash
  360 +
  361 + app/console doctrine:phpcr:dump /cms/simple --props=yes
  362 +
  363 +
34 reference/simple-cms.rst
Source Rendered
... ... @@ -0,0 +1,34 @@
  1 +SymfonyCmfSimpleCmsBundle
  2 +=========================
  3 +
  4 +The `SymfonyCmfSimpleCmsBundle <https://github.com/symfony-cmf/SimpleCmsBundle#readme>`_
  5 +provides a simplistic CMS on top of the CMF components and bundles.
  6 +
  7 +While the core CMF components focus on flexibility, the simple CMS trades
  8 +away some of that flexibility in favor of simplicity.
  9 +
  10 +.. index:: SimpleCmsBundle
  11 +
  12 +Dependencies
  13 +------------
  14 +
  15 +As specified in the bundle ``composer.json`` this bundle depends on most CMF bundles.
  16 +
  17 +Configuration
  18 +-------------
  19 +
  20 +The configuration key for this bundle is ``symfony_cmf_simple_cms``
  21 +
  22 +
  23 +.. Tip::
  24 +
  25 + If you have the sonata phpcr-odm admin bundle enabled but do *NOT* want to
  26 + show the default admin provided by this bundle, you can add the following
  27 + to your configuration
  28 +
  29 + .. configuration-block::
  30 +
  31 + .. code-block:: yaml
  32 +
  33 + symfony_cmf_simple_cms:
  34 + use_sonata_admin: false
31 tutorials/installing-configuring-cmf.rst
Source Rendered
@@ -5,8 +5,11 @@ The goal of this tutorial is to get you up and running with an application build
5 5
6 6 If this is your first encounter with the Symfony CMF it would be a good idea to first take a
7 7 look at `the big picture <http://slides.liip.ch/static/2012-01-17_symfony_cmf_big_picture.html#1>`_
8   -and/or the `CMF sandbox environment <https://github.com/symfony-cmf/symfony-cmf>`_ which is a
9   -pre-installed Symfony / CMF application containing all CMF components.
  8 +and/or the `CMF sandbox environment <https://github.com/symfony-cmf/cmf-sandbox>`_ which is a
  9 +pre-installed Symfony / CMF application containing all CMF components. It is also available online
  10 +at `cmf.liip.ch<http://cmf.liip.ch>`.
  11 +
  12 +If you want to create content in scripts, have a look at the `fixtures loading code <https://github.com/symfony-cmf/cmf-sandbox/blob/master/src/Sandbox/MainBundle/DataFixtures/PHPCR/>`_..
10 13
11 14 .. index:: RoutingExtraBundle, CoreBundle, MultilangContentBundle, MenuBundle, ContentBundle, SonataBlockBundle, KnpMenuBundle
12 15
@@ -20,20 +23,28 @@ Installation
20 23
21 24 Download the bundles
22 25 ~~~~~~~~~~~~~~~~~~~~
23   -Add the following to your ``composer.json`` file::
  26 +Add the following to your ``composer.json`` file
  27 +
  28 +.. code-block:: javascript
24 29
25 30 "require": {
26 31 ...
27 32 "symfony-cmf/symfony-cmf": "1.0.*"
28 33 }
29 34
30   -And then run::
  35 +And then run
  36 +
  37 +.. code-block:: bash
31 38
32 39 php composer.phar update
33 40
  41 +
34 42 Initialize bundles
35 43 ~~~~~~~~~~~~~~~~~~
36   -Next, initialize the bundles in ``app/AppKernel.php`` by adding them to the ``registerBundle`` method::
  44 +
  45 +Next, initialize the bundles in ``app/AppKernel.php`` by adding them to the ``registerBundle`` method
  46 +
  47 +.. code-block:: php
37 48
38 49 public function registerBundles()
39 50 {
@@ -61,14 +72,18 @@ Next, initialize the bundles in ``app/AppKernel.php`` by adding them to the ``re
61 72 Note that this also installs the PHPCR ODM and related dependencies, setup instructions
62 73 can be found in the dedicated documentation.
63 74
  75 +
64 76 Configuration
65 77 -------------
  78 +
66 79 To get your application running very little configuration is needed. But because the
67 80 SymfonyCmfMenuBundle is dependent of the doctrine router you need to explicitly enable
68 81 the doctrine router as per default it is not loaded.
69 82
70 83 To enable the dynamic router and to add the router to the routing chain add the following to ``app/config/config.yml``::
71 84
  85 +.. code-block:: yaml
  86 +
72 87 symfony_cmf_routing_extra:
73 88 chain:
74 89 routers_by_id:
@@ -82,14 +97,18 @@ See :doc:`/reference/routing-extra`
82 97
83 98 For a basic functionality for the BlockBundle (required)::
84 99
  100 +.. code-block:: yaml
  101 +
85 102 sonata_block:
86 103 default_contexts: [cms]
87 104
88 105 If you are *NOT* using `SonataAdminBundle <https://github.com/sonata-project/SonataAdminBundle>`_ the following configuration is needed::
89 106
  107 +.. code-block:: yaml
  108 +
90 109 symfony_cmf_menu:
91 110 use_sonata_admin: false
92 111
93 112 For now this is the only configuration we need. Mastering the configuration of the different
94 113 bundles will be handled in further tutorials. If you're looking for the configuration of a
95   -specific bundle take a look at the reference (TODO link).
  114 +specific bundle take a look at the corresponding :doc:`reference entry</index>`.
379 tutorials/installing-configuring-doctrine-phpcr-odm.rst
Source Rendered
... ... @@ -1,192 +1,187 @@
1   -Installing and configuring Doctrine PHPCR ODM
2   -=============================================
3   -The goal of this tutorial is to install and configure Doctrine PHPCR ODM.
4   -
5   -For more details see the `official PHPCR ODM documentation <http://www.doctrine-project.org/projects/phpcr-odm.html>`_
6   -Some additional information can be found on the
7   -`DoctrinePhpcrBundle github.com project <https://github.com/doctrine/DoctrinePHPCRBundle>`_
8   -which for the most part mimics the standard `DoctrineBundle <https://github.com/doctrine/DoctrineBundle>`_.
9   -
10   -Finally for information about PHPCR see the `official PHPCR website <http://phpcr.github.com>`_.
11   -
12   -.. index:: PHPCR, ODM
13   -
14   -Preconditions
15   --------------
16   -- php >= 5.3
17   -- libxml version >= 2.7.0 (due to a bug in libxml http://bugs.php.net/bug.php?id=36501)
18   -- phpunit >= 3.6 (if you want to run the tests)
19   -- Symfony2.1 (currently master)
20   -
21   -Installation
22   -------------
23   -
24   -Choosing a content repository
25   -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26   -
27   -The first thing to decide is what content repository to use. A content repository is essentially
28   -a database that will be responsible for storing all the content you want to persist. It provides
29   -and API that is optimized for the needs of a CMS (tree structures, references, versioning, full
30   -text search etc.). While every content repository can have very different requirements and
31   -performance characteristics, the API is the same for all of them.
32   -
33   -Furthermore since the API defines an export/import format, you can always switch to a different
34   -content repository implementation later on.
35   -
36   -These are the available choices:
37   -
38   -* Jackalope with Jackrabbit (Jackrabbit requires Java, it can persist into the file system, a database etc.)
39   -* Jackalope with Doctrine DBAL (requires an RDBMS like MySQL, PostgreSQL or SQLite)
40   -* Midgard (requires an RDBMS like MySQL, PostgreSQL or SQLite)
41   -
42   -Depending on your choice you can omit certain steps in the following documentation.
43   -
44   -Download the bundles
45   -~~~~~~~~~~~~~~~~~~~~
46   -Add the following to your ``composer.json`` file::
47   -
48   - "require": {
49   - ...
50   - "jackalope/jackalope-jackrabbit": "1.0.*"
51   - "jackalope/jackalope-doctrine-dbal": "dev-master"
52   - "midgard/phpcr": "dev-master"
53   - "doctrine/phpcr-bundle": "1.0.*",
54   - "doctrine/phpcr-odm": "1.0.*",
55   - }
56   -
57   -Notice: Remember to check if you are using "doctrine/orm": "2.2.*" (Symfony 2.1 default) and switch to "2.3.*" before updating.
58   -
59   -And then run::
60   -
61   - php composer.phar update
62   -
63   -Register annotations
64   -~~~~~~~~~~~~~~~~~~~~
65   -Add file to annotation registry in ``app/autoload.php`` for the ODM annotations right after the last ``AnnotationRegistry::registerFile`` line::
66   -
67   - // ...
68   - AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/Annotations/DoctrineAnnotations.php');
69   - // ...
70   -
71   -Initialize bundles
72   -~~~~~~~~~~~~~~~~~~
73   -Next, initialize the bundles in ``app/AppKernel.php`` by adding them to the ``registerBundle`` method::
74   -
75   - public function registerBundles()
76   - {
77   - $bundles = array(
78   - // ...
79   -
80   - // Doctrine PHPCR
81   - new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
82   -
83   - );
84   - // ...
85   - }
86   -
87   -
88   -Configuration
89   --------------
90   -Next step is to configure the bundles.
91   -
92   -Doctrine PHPCR ODM
93   -~~~~~~~~~~~~~~~~~~
94   -Basic configuration, add to ``app/config/config.yml``::
95   -
96   - doctrine_phpcr:
97   - session:
98   - backend:
99   - # Jackalope Jackrabbit
100   - type: jackrabbit
101   - url: http://localhost:8080/server/
102   - # Jackalope Doctrine DBAL (make sure to also configure the DoctrineBundle accordingly)
103   - type: doctrinedbal
104   - connection: doctrine.dbal.default_connection
105   - # Midgard
106   - type: midgard2
107   - db_type: MySQL
108   - db_name: midgard2_test
109   - db_host: "0.0.0.0"
110   - db_port: 3306
111   - db_username: ""
112   - db_password: ""
113   - db_init: true
114   - blobdir: /tmp/cmf-blobs
115   - workspace: default
116   - username: admin
117   - password: admin
118   -
119   -More information on configuring this bundle can be found `here <https://github.com/doctrine/DoctrinePHPCRBundle#readme>`_.
120   -
121   -Setting up the content repository
122   ----------------------------------
123   -
124   -Jackalope Jackrabbit
125   -~~~~~~~~~~~~~~~~~~~~
126   -
127   -.. index:: Jackrabbit
128   -
129   -These are the steps necessary to install Apache Jackrabbit:
130   -
131   -- Make sure you have Java Virtual Machine installed on your box. If not, you can grab one from here: http://www.java.com/en/download/manual.jsp
132   -- Download the latest version from the `Jackrabbit Downloads page <http://jackrabbit.apache.org/downloads.html>`_
133   -- Run the server. Go to the folder where you downloaded the .jar file and launch it::
134   -
135   - java -jar jackrabbit-standalone-*.jar
136   -
137   -Going to http://localhost:8080/ should now display a Apache Jackrabbit page.
138   -
139   -More information about `running a Jackrabbit server <https://github.com/jackalope/jackalope/wiki/Running-a-jackrabbit-server>`_
140   -can be found on the Jackalope wiki.
141   -
142   -As we are using Jackalope as our PHPCR implementation we could also chose other storage backends
143   -like relational databases but for this tutorial we're going to use Jackrabbit.
144   -
145   -Jackalope Doctrine DBAL
146   -~~~~~~~~~~~~~~~~~~~~~~~
147   -
148   -.. index:: Doctrine, DBAL, RDBMS
149   -
150   -In order to setup the database run the following steps to create the database and setup a default schema::
151   -
152   - app/console doctrine:database:create
153   - app/console doctrine:phpcr:init:dbal
154   -
155   -For more information of how to configure Doctrine DBAL with Symfony2 see the
156   -`official Symfony2 documentation <http://symfony.com/doc/current/book/doctrine.html>`_.
157   -
158   -Midgard
159   -~~~~~~~
160   -
161   -.. index:: Midgard, RDBMS
162   -
163   -Midgard is a C extension that implements the PHPCR API on top of a standard RDBMS.
164   -
165   -See `official Midgard PHPCR documentation <http://midgard-project.org/phpcr/>`_
166   -
167   -Registering system node types
168   ------------------------------
169   -PHPCR ODM uses a `custom node type <https://github.com/doctrine/phpcr-odm/wiki/Custom-node-type-phpcr%3Amanaged>`_
170   -to track meta information without interfering with your content. There is a command that makes it trivial to
171   -register this type and the PHPCR namespace::
172   -
173   - php app/console doctrine:phpcr:register-system-node-types
174   -
175   -Creating a new workspace
176   -------------------------
177   -
178   -This step is optional since there is always a workspace "default" available::
179   -
180   - app/console doctrine:phpcr:workspace:create my_workspace
181   -
182   -Other useful commands
183   ----------------------
184   -
185   -With the following command its possible to dump the (partial) structure in a PHPCR repository::
186   -
187   - app/console doctrine:phpcr:dump
188   -
189   -Its also possible to issue an `SQL2 query <http://www.h2database.com/jcr/grammar.html>`_ against the repository::
190   -
191   - app/console doctrine:phpcr:query "SELECT routeContent FROM [nt:unstructured] WHERE NAME() = 'home'"
192   -
  1 +Installing and configuring Doctrine PHPCR ODM
  2 +=============================================
  3 +The goal of this tutorial is to install and configure Doctrine PHPCR ODM.
  4 +
  5 +For more details see the `official PHPCR ODM documentation <http://www.doctrine-project.org/projects/phpcr-odm.html>`_
  6 +Some additional information can be found on the
  7 +`DoctrinePhpcrBundle github.com project <https://github.com/doctrine/DoctrinePHPCRBundle>`_
  8 +which for the most part mimics the standard `DoctrineBundle <https://github.com/doctrine/DoctrineBundle>`_.
  9 +
  10 +Finally for information about PHPCR see the `official PHPCR website <http://phpcr.github.com>`_.
  11 +
  12 +.. index:: PHPCR, ODM
  13 +
  14 +Preconditions
  15 +-------------
  16 +- php >= 5.3
  17 +- libxml version >= 2.7.0 (due to a bug in libxml http://bugs.php.net/bug.php?id=36501)
  18 +- phpunit >= 3.6 (if you want to run the tests)
  19 +- Symfony2.1 (currently master)
  20 +
  21 +Installation
  22 +------------
  23 +
  24 +Choosing a content repository
  25 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  26 +
  27 +The first thing to decide is what content repository to use. A content repository is essentially
  28 +a database that will be responsible for storing all the content you want to persist. It provides
  29 +and API that is optimized for the needs of a CMS (tree structures, references, versioning, full
  30 +text search etc.). While every content repository can have very different requirements and
  31 +performance characteristics, the API is the same for all of them.
  32 +
  33 +Furthermore since the API defines an export/import format, you can always switch to a different
  34 +content repository implementation later on.
  35 +
  36 +These are the available choices:
  37 +
  38 +* Jackalope with Jackrabbit (Jackrabbit requires Java, it can persist into the file system, a database etc.)
  39 +* Jackalope with Doctrine DBAL (requires an RDBMS like MySQL, PostgreSQL or SQLite)
  40 +* Midgard (requires an RDBMS like MySQL, PostgreSQL or SQLite)
  41 +
  42 +Depending on your choice you can omit certain steps in the following documentation.
  43 +
  44 +Download the bundles
  45 +~~~~~~~~~~~~~~~~~~~~
  46 +Add the following to your ``composer.json`` file::
  47 +
  48 + "require": {
  49 + ...
  50 + "jackalope/jackalope-jackrabbit": "1.0.*"
  51 + "jackalope/jackalope-doctrine-dbal": "dev-master"
  52 + "midgard/phpcr": "dev-master"
  53 + "doctrine/phpcr-bundle": "1.0.*",
  54 + "doctrine/phpcr-odm": "1.0.*",
  55 + }
  56 +
  57 +Notice: Remember to check if you are using "doctrine/orm": "2.2.*" (Symfony 2.1 default) and switch to "2.3.*" before updating.
  58 +
  59 +And then run::
  60 +
  61 + php composer.phar update
  62 +
  63 +Register annotations
  64 +~~~~~~~~~~~~~~~~~~~~
  65 +Add file to annotation registry in ``app/autoload.php`` for the ODM annotations right after the last ``AnnotationRegistry::registerFile`` line::
  66 +
  67 + // ...
  68 + AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/Annotations/DoctrineAnnotations.php');
  69 + // ...
  70 +
  71 +Initialize bundles
  72 +~~~~~~~~~~~~~~~~~~
  73 +Next, initialize the bundles in ``app/AppKernel.php`` by adding them to the ``registerBundle`` method::
  74 +
  75 + public function registerBundles()
  76 + {
  77 + $bundles = array(
  78 + // ...
  79 +
  80 + // Doctrine PHPCR
  81 + new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
  82 +
  83 + );