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

Commit 0814acc

Browse files
committed
Reverted 1.1 features
1 parent c01942b commit 0814acc

File tree

11 files changed

+78
-186
lines changed

11 files changed

+78
-186
lines changed

book/routing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ order of precedence):
248248

249249
* Explicit: The ``Route`` document itself can explicitly declare the target
250250
Controller if one is returned from ``getDefault('_controller')``.
251-
* By type The ``Route`` document returns a value from ``getDefault('type')``,
251+
* By alias: The ``Route`` document returns a value from ``getDefault('type')``,
252252
which is then matched against the provided configuration from config.yml
253253
* By class: Requires the ``Route`` document to implement ``RouteObjectInterface``
254254
and return an object for ``getContent()``. The returned class type is
@@ -302,7 +302,7 @@ Here's an example of how to configure the above mentioned options:
302302
cmf_content.controller::indexAction
303303
</controllers-by-class>
304304
305-
<templates-by-class class"Symfony\Cmf\Bundle\ContentBundle\Document\StaticContent"
305+
<templates-by-class alias="Symfony\Cmf\Bundle\ContentBundle\Document\StaticContent"
306306
>
307307
CmfContentBundle:StaticContent:index.html.twig
308308
</templates-by-class>

bundles/create/introduction.rst

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -281,30 +281,12 @@ Access Control
281281

282282
In order to limit who can edit content, the provided controllers as well as the
283283
JavaScript loader check if the current user is granted the configured
284-
``cmf_create.security.role``. By default the role is ``ROLE_ADMIN``.
284+
``cmf_create.role``. By default the role is ``ROLE_ADMIN``.
285285

286286
.. tip::
287287

288288
In order to have security in place, you need to configure a
289289
"Symfony2 firewall". Read more in the `Symfony2 security chapter`_.
290-
If you do not do that, create.js will not be loaded and editing
291-
will be disabled.
292-
293-
If you do not want to edit on the production domain directly, e.g.
294-
because of caching, you can provide a second domain where you have
295-
security configured and do the editing there.
296-
297-
You can completely disable security checks by setting the role parameter to
298-
boolean ``false``. Then you need to configure access permissions on the routes
299-
defined in ``Resources/routing/rest.xml`` and, if activated, in ``image.xml``.
300-
If you set the role to false but do not configure any security,
301-
**every visitor of your site will be able to edit the content**.
302-
You also will need custom logic to decide whether to include the create.js
303-
JavaScript files.
304-
305-
You can also use a custom security check service by implementing
306-
``Symfony\Cmf\Bundle\CreateBundle\Security\AccessCheckerInterface``
307-
and setting this service in ``cmf_create.security.checker_service``.
308290

309291
If you need more fine grained access control, look into the CreatePHP
310292
``RdfMapperInterface`` ``isEditable`` method. You can extend a mapper and
@@ -314,12 +296,9 @@ editable.
314296
Load create.js JavaScript and CSS
315297
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
316298

317-
This bundle provides a template that loads the required CSS files, as well as
318-
a controller action that loads the necessary JavaScript *if* the current user
319-
is allowed to edit according to
320-
:ref:`the security configuration <bundle_create_introduction_access_control>`.
321-
The JavaScript loader also parametrizes the configuration for create.js and
322-
WYSIWYG editor.
299+
This bundle provides templates that load the required Javascript and CSS files
300+
based on Assetic. The Javascript loader also parametrizes the configuration
301+
for create.js and the chosen editor.
323302

324303
Alternatively, you can of course use your own templates to include the assets
325304
needed by create.js.
@@ -377,12 +356,6 @@ For Symfony 2.1, the syntax is:
377356
'_locale' => $app->getRequest()->getLocale(),
378357
) ?>
379358
380-
.. tip::
381-
382-
You can include this call unconditionally. The controller checks if the
383-
current user is allowed to edit and only in that case includes the
384-
JavaScript.
385-
386359
.. note::
387360

388361
The provided JavaScript file configures create.js and the editor. If you
@@ -391,7 +364,6 @@ For Symfony 2.1, the syntax is:
391364
configuration further, you will need to use a
392365
:ref:`custom template to load the editor<bundle-create-custom>`.
393366

394-
395367
.. _bundle-create-usage-embed:
396368

397369
Rendering Content

bundles/phpcr_odm.rst

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,6 @@ and remove them on the fly.
588588
phpcr_odm_reference_collection
589589
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
590590

591-
.. caution::
592-
593-
This form type was deprecated in DoctrinePHPCRBundle 1.1 and will be
594-
removed in DoctrinePHPCRBundle 1.2. You should use the `phpcr_document`_
595-
type instead, which can do the same but better.
596-
597591
This form type handles editing ``ReferenceMany`` collections on PHPCR-ODM
598592
documents. It is a choice field with an added ``referenced_class`` required
599593
option that specifies the class of the referenced target document.
@@ -691,16 +685,7 @@ A service to use the generic initializer looks like this:
691685
$definition->addTag('doctrine_phpcr.initializer');
692686
$container->setDefinition('acme.phpcr.initializer', $definition);
693687
694-
You can execute your initializers using the following command:
695-
696-
.. code-block:: bash
697-
698-
$ php app/console doctrine:phpcr:repository:init
699-
700-
.. versionadded:: 1.1
701-
702-
Since DoctrinePHPCRBundle 1.1 the load data fixtures command will automatically
703-
execute the initializers after purging the database.
688+
The ``doctrine:phpcr:repository:init`` command runs all tagged initializers.
704689

705690
Fixture Loading
706691
---------------

cookbook/create_new_project_phpcr_odm.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ content repository.
4444
* Remove the ``doctrine\orm`` package from ``composer.json``;
4545
* Remove the ``orm`` section from ``app/config/config.yml``.
4646

47-
**Step 4**: Add the DoctrinePHPCRBundle to the AppKernel::
47+
**Step 4**: Add the DoctrinePHPCRBundle to the ``AppKernel``::
4848

4949
// app/AppKernel.php
5050

@@ -62,7 +62,16 @@ content repository.
6262
}
6363
}
6464

65-
**Step 5**: Modify ``parameters.yml.dist``, adding the required PHPCR-ODM settings:
65+
**Step 5**: (*optional*) Register the PHPCR-ODM annotations in ``app/autoload.php``::
66+
67+
// app/autoload.php
68+
69+
// ...
70+
AnnotationRegistry::registerFile(
71+
__DIR__.'/../vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/Annotations/DoctrineAnnotations.php'
72+
);
73+
74+
**Step 6**: Modify ``parameters.yml.dist``, adding the required PHPCR-ODM settings:
6675

6776
.. code-block:: yaml
6877
@@ -133,7 +142,7 @@ content repository.
133142
),
134143
));
135144
136-
**Step 7**: Run ``composer update``:
145+
**Step 8**: Run ``composer update``:
137146

138147
.. code-block:: bash
139148

cookbook/creating_a_cms/getting-started.rst

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,12 @@ example with ``{{ path(content) }}`` in Twig).
246246
Repository Initializer
247247
~~~~~~~~~~~~~~~~~~~~~~
248248

249-
:ref:`Repository initializers <phpcr-odm-repository-initializers>` enable you to establish and maintain PHPCR nodes
250-
required by your application, for example you will need the paths
251-
``/cms/pages``, ``/cms/posts`` and ``/cms/routes``. The ``GenericInitializer``
252-
class can be used easily initialize a list of paths. Add the following to your
253-
service container configuration:
249+
:ref:`Repository initializers <phpcr-odm-repository-initializers>` enable you
250+
to establish and maintain PHPCR nodes required by your application, for
251+
example you will need the paths ``/cms/pages``, ``/cms/posts`` and
252+
``/cms/routes``. The ``GenericInitializer`` class can be used easily
253+
initialize a list of paths. Add the following to your service container
254+
configuration:
254255

255256
.. configuration-block::
256257

@@ -366,6 +367,7 @@ Create a page for your CMS::
366367
{
367368
public function load(ObjectManager $dm)
368369
{
370+
NodeHelper::createPath($dm->getPhpcrSession(), '/cms/pages');
369371
$parent = $dm->find(null, '/cms/pages');
370372

371373
$page = new Page();
@@ -396,6 +398,7 @@ and add some posts::
396398
public function load(ObjectManager $dm)
397399
{
398400
$parent = $dm->find(null, '/cms/posts');
401+
NodeHelper::createPath($dm->getPhpcrSession(), '/cms/posts');
399402

400403
foreach (array('First', 'Second', 'Third', 'Forth') as $title) {
401404
$post = new Post();
@@ -421,6 +424,15 @@ and load the fixtures:
421424
422425
You should now have some data in your content repository.
423426

427+
.. note::
428+
429+
The classes above use ``NodeHelper::createPath`` to create the paths
430+
``/cms/posts`` and ``/cms/pages`` - this is exactly what the
431+
initializer did -- why do the classes do it again? This is a known issue - the
432+
data fixtures loader will purge the workspace and it will **not** call the
433+
initializer, so when using data fixtures it is currently necessary to manually
434+
create the paths.
435+
424436
.. _`routingautobundle documentation`: http://symfony.com/doc/current/cmf/bundles/routing_auto.html
425437
.. _`dynamicrouter to generate urls`: http://symfony.com/doc/current/cmf/bundles/routing/dynamic.html#url-generation-with-the-dynamicrouterA
426438
.. _`idempotent`: http://en.wiktionary.org/wiki/idempotent

cookbook/creating_a_cms/make-homepage.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ and verify that the ``cms`` node has been updated by using the
195195
disadvantage then is that there are two places where initialization
196196
choices take place - do whatever you prefer.
197197

198+
As noted earlier, currently when data fixtures are loaded they will erase the
199+
workspace, including the paths created by the initializers. This means that
200+
each time you load your data fixtures you must also reinitialize the
201+
repository.
202+
198203
Create the Make Homepage Button
199204
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200205

cookbook/editions/cmf_core.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ If you haven't done so already, make sure you have followed these steps from
9999

100100
* Initialize ``DoctrinePHPCRBundle`` in ``app/AppKernel.php``
101101
* Ensure there is a ``doctrine_phpcr:`` section in ``app/config/config.yml``
102+
* Add the ``AnnotationRegistry::registerFile`` line to ``app/autoload.php``
102103

103104
Configure the BlockBundle in your ``config.yml``:
104105

cookbook/installing_configuring_doctrine_phpcr_odm.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,19 @@ To install the above dependencies, run:
132132
133133
$ php composer.phar update
134134
135+
Register Annotations
136+
~~~~~~~~~~~~~~~~~~~~
137+
138+
PHPCR-ODM uses annotations and these need to be registered in your
139+
``app/autoload.php`` file. Add the following line, immediately after the last
140+
``AnnotationRegistry::registerFile`` line::
141+
142+
// app/autoload.php
143+
144+
// ...
145+
AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/Annotations/DoctrineAnnotations.php');
146+
// ...
147+
135148
Initialize Bundles
136149
~~~~~~~~~~~~~~~~~~
137150

reference/configuration/core.rst

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -253,67 +253,3 @@ only published routes and content can be accessed.
253253
'request_listener' => true,
254254
),
255255
));
256-
257-
Sonata Admin
258-
------------
259-
260-
This section configures the Sonata Admin Extensions, see:
261-
262-
* :ref:`Publish Workflow Admin Extensions <bundle-core-workflow-admin-extensions>`;
263-
* :ref:`Translatable Admin Extension <bundle-core-translatable-admin-extension>`.
264-
265-
.. configuration-block::
266-
267-
.. code-block:: yaml
268-
269-
cmf_core:
270-
sonata_admin:
271-
extensions:
272-
publishable:
273-
form_group: form.group_publish_workflow
274-
publish_time:
275-
form_group: form.group_general
276-
translatable:
277-
form_group: form.group_general
278-
279-
.. code-block:: xml
280-
281-
<?xml version="1.0" charset="UTF-8" ?>
282-
<container xmlns="http://symfony.com/schema/dic/services">
283-
284-
<config xmlns="http://cmf.symfony.com/schema/dic/core">
285-
<sonata-admin>
286-
<extension>
287-
<publishable form-group="form.group_publish_workflow" />
288-
<publish-time form-group="form.group_general" />
289-
<translatable form-group="form.group_general" />
290-
</extension>
291-
</sonata-admin>
292-
</config>
293-
</container>
294-
295-
.. code-block:: php
296-
297-
$container->loadFromExtension('cmf_core', array(
298-
'sonata_admin' => array(
299-
'extensions' => array(
300-
'publishable' => array(
301-
'form_group' => 'form.group_publish_workflow',
302-
),
303-
'publish_time' => array(
304-
'form_group' => 'form.group_general',
305-
),
306-
'translatable' => array(
307-
'form_group' => 'form.group_general',
308-
),
309-
),
310-
),
311-
));
312-
313-
form_group
314-
~~~~~~~~~~
315-
316-
**type**: ``string`` **default**: as in above example.
317-
318-
Defines which form group the fields from this extension will appear in within
319-
the Sonata Admin edit interface.

reference/configuration/create.rst

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,49 +18,33 @@ Configuration
1818
Security
1919
~~~~~~~~
2020

21-
The controller that receives save requests from create.js does a security check
22-
to determine whether the current user is allowed to edit content. As it would
21+
The controller that receives save requests from create.js requires the user to
22+
have a specific role to control who is allowed to edit content. As it would
2323
not be convenient to show the create.js editor to users not allowed to edit the
24-
site, the controller loading the create.js JavaScript files with the
25-
``includeJSFilesAction`` also uses the same security check, as does the image
26-
upload controller if it is activated.
27-
28-
The default security check checks if the user has a specified role. If nothing
29-
is configured, the default role is ``ROLE_ADMIN``. If you set the parameter to
30-
boolean ``false``, every user will be allowed to save changes through the REST
31-
controller.
32-
33-
A last option is to configure your own ``checker_service`` to be used instead
34-
of the role based check.
35-
36-
For more information, see the
37-
:ref:`security section in the bundle doc <bundle_create_introduction_access_control>`.
24+
site, the controller loading the create.js javascripts with the
25+
``includeJSFilesAction`` also checks this role. If the image controller is
26+
activated, it checks for this role as well.
3827

3928
.. configuration-block::
4029

4130
.. code-block:: yaml
4231
4332
cmf_create:
44-
security:
45-
role: ROLE_ADMIN
46-
checker_service: ~
33+
role: ROLE_ADMIN
4734
4835
.. code-block:: xml
4936
5037
<?xml version="1.0" charset="UTF-8" ?>
5138
<container xmlns="http://symfony.com/schema/dic/services">
52-
<config xmlns="http://cmf.symfony.com/schema/dic/create">
53-
<security role="ROLE_ADMIN" checker-service="null"/>
54-
<config/>
39+
<config xmlns="http://cmf.symfony.com/schema/dic/create"
40+
role="ROLE_ADMIN"
41+
/>
5542
</container>
5643
5744
.. code-block:: php
5845
5946
$container->loadFromExtension('cmf_create', array(
60-
'security' => array(
61-
'role' => 'ROLE_ADMIN',
62-
'checker_service' => null,
63-
),
47+
'role' => 'ROLE_ADMIN',
6448
));
6549
6650
.. _config-create-persistence:

0 commit comments

Comments
 (0)