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

Commit 128345a

Browse files
committed
Merge pull request #594 from symfony-cmf/dev
1.2.0
2 parents 72a02cd + 5d96f9c commit 128345a

30 files changed

+409
-64
lines changed

book/installation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ and then get the Symfony CMF code with it (this may take a while):
6060

6161
.. code-block:: bash
6262
63-
$ php composer.phar create-project symfony-cmf/standard-edition <path-to-install> ~1.1
63+
$ composer create-project symfony-cmf/standard-edition <path-to-install> ~1.2
6464
$ cd <path-to-install>
6565
6666
.. note::
@@ -76,7 +76,7 @@ to configure the permissions and then run the ``install`` command:
7676

7777
.. code-block:: bash
7878
79-
$ php composer.phar install
79+
$ composer install
8080
8181
2) GIT
8282
~~~~~~
@@ -94,7 +94,7 @@ dependencies, use the ``install`` command:
9494

9595
.. code-block:: bash
9696
97-
$ php composer.phar install
97+
$ composer install
9898
9999
100100
Set up the Database

book/routing.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ follows::
453453
use Doctrine\Common\Persistence\ObjectManager;
454454
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
455455
use Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent;
456+
use PHPCR\Util\NodeHelper;
456457

457458
class LoadRoutingData implements FixtureInterface
458459
{
@@ -461,6 +462,13 @@ follows::
461462
*/
462463
public function load(ObjectManager $dm)
463464
{
465+
if (!$dm instanceof DocumentManager) {
466+
$class = get_class($dm);
467+
throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given.");
468+
}
469+
470+
NodeHelper::createPath($session, '/cms/routes');
471+
464472
$route = new Route();
465473
$route->setParentDocument($dm->find(null, '/cms/routes'));
466474
$route->setName('projects');
@@ -486,6 +494,15 @@ follows::
486494
This will give you a document that matches the URL ``/projects/<number>`` but
487495
also ``/projects`` as there is a default for the id parameter.
488496

497+
.. caution::
498+
499+
As you can see, the code explicitely creates the ``/cms/routes`` path.
500+
The RoutingBundle only creates this path automatically if the Sonata Admin
501+
was enabled in the routing configuration using an :ref:`initializer
502+
<phpcr-odm-repository-initializers>`. Otherwise, it'll assume you do
503+
something yourself to create the path (by configuring an initializer or
504+
doing it in a fixture like this).
505+
489506
Because you defined the ``{id}`` route parameter, your controller can expect an
490507
``$id`` parameter. Additionally, because you called setRouteContent on the
491508
route, your controller can expect the ``$contentDocument`` parameter.

book/simplecms.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ To create a page, use the
6161
*/
6262
public function load(ObjectManager $dm)
6363
{
64+
if (!$dm instanceof DocumentManager) {
65+
$class = get_class($dm);
66+
throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given.");
67+
}
68+
6469
$parent = $dm->find(null, '/cms/simple');
6570
$page = new Page();
6671
$page->setTitle('About Symfony CMF');
@@ -111,6 +116,11 @@ structure, you would do::
111116
*/
112117
public function load(ObjectManager $dm)
113118
{
119+
if (!$dm instanceof DocumentManager) {
120+
$class = get_class($dm);
121+
throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given.");
122+
}
123+
114124
$root = $dm->find(null, '/cms/simple');
115125

116126
$about = new Page();

bundles/content/exposing_content_via_rest.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Then use Composer_ to update your projects vendors:
4343

4444
.. code-block:: bash
4545
46-
$ php composer.phar update
46+
$ composer update
4747
4848
Configuring FOSRestBundle
4949
-------------------------

bundles/core/dependency_injection_tags.rst

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,6 @@
44
Dependency Injection Tags
55
-------------------------
66

7-
cmf_request_aware
8-
~~~~~~~~~~~~~~~~~
9-
10-
.. caution::
11-
12-
This tag has been deprecated in CoreBundle 1.1 and will be removed
13-
in CoreBundle 1.2. Since Symfony 2.3, you can profit from the fact
14-
that the request is a `synchronized service`_.
15-
16-
When working with the 1.0 version of the CMF in Symfony 2.2 and you have
17-
services that need the request (e.g. for the publishing workflow or current
18-
menu item voters), you can tag services with ``cmf_request_aware`` to have a
19-
kernel listener inject the request. Any class used in such a tagged service
20-
must have the ``setRequest`` method or you will get a fatal error::
21-
22-
use Symfony\Component\HttpFoundation\Request;
23-
24-
class MyClass
25-
{
26-
private $request;
27-
28-
public function setRequest(Request $request)
29-
{
30-
$this->request = $request;
31-
}
32-
}
33-
347
cmf_published_voter
358
~~~~~~~~~~~~~~~~~~~
369

bundles/create/configuration.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ persistence configuration has the following configuration:
8585
model_class: ~
8686
controller_class: Symfony\Cmf\Bundle\CreateBundle\Controller\ImageController
8787
basepath: /cms/media
88+
delete: false
8889
8990
.. code-block:: xml
9091
@@ -95,6 +96,7 @@ persistence configuration has the following configuration:
9596
<phpcr
9697
enabled="false"
9798
manager-name="null"
99+
delete="false"
98100
>
99101
<image
100102
enabled="false"
@@ -120,6 +122,7 @@ persistence configuration has the following configuration:
120122
'controller_class' => 'Symfony\Cmf\Bundle\CreateBundle\Controller\ImageController',
121123
'basepath' => '/cms/media',
122124
),
125+
'delete' => false,
123126
),
124127
),
125128
));
@@ -152,6 +155,14 @@ provided by the MediaBundle.
152155
If you need different image handling, you can either overwrite
153156
``model_class`` and/or the ``controller_class``.
154157

158+
delete
159+
""""""
160+
**type**: ``boolean`` **default**: ``false``
161+
162+
Set delete to true to enable the simple delete workflow. This allows to directly
163+
delete content from the frontend. Be careful, there are no special checks once you confirm deletion
164+
your content is gone.
165+
155166
Metadata Handling
156167
~~~~~~~~~~~~~~~~~
157168

@@ -208,7 +219,17 @@ REST handler
208219
~~~~~~~~~~~~
209220

210221
You can configure the REST handler class with the ``rest_controller_class``
211-
option.
222+
option. Furthermore it is possible to enable ``rest_force_request_locale``.
223+
When this option is enabled, the current request locale is set on the model
224+
instance. This is useful in order to automatically translate a model to
225+
the request locale when using inline editing, instead of editing the model
226+
in the locale in which it is currently stored, which might be different
227+
than the request locale due to language fallback.
228+
229+
.. note::
230+
231+
The ``rest_force_request_locale`` option requires that the
232+
:doc:`CoreBundle <../core/introduction>` is enabled.
212233

213234
Editor configuration
214235
~~~~~~~~~~~~~~~~~~~~

bundles/create/introduction.rst

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,22 @@ overwrite them) are:
117117
118118
{
119119
"extra": {
120-
"create-directory": "vendor/symfony-cmf/create-bundle/Symfony/Cmf/Bundle/CreateBundle/Resources/public/vendor/create",
120+
"create-directory": "vendor/symfony-cmf/create-bundle/Resources/public/vendor/create",
121121
"create-repository": "https://github.com/bergie/create.git",
122122
"create-commit": "a148ce9633535930d7b4b70cc1088102f5c5eb90"
123123
124-
"ckeditor-directory": "vendor/symfony-cmf/create-bundle/Symfony/Cmf/Bundle/CreateBundle/Resources/public/vendor/ckeditor",
124+
"ckeditor-directory": "vendor/symfony-cmf/create-bundle/Resources/public/vendor/ckeditor",
125125
"ckeditor-repository": "https://github.com/ckeditor/ckeditor-releases.git",
126126
"ckeditor-commit": "bba29309f93a1ace1e2e3a3bd086025975abbad0"
127127
}
128128
}
129129
130+
.. versionadded:: 1.2
131+
The Symfony CMF bundles updated to PSR-4 autoloading with Symfony CMF
132+
1.2. Before, the target directories were located in the
133+
``vendor/symfony-cmf/create-bundle/Symfony/Cmf/Bundle/CreateBundle/Resources/public/vendor``
134+
directory.
135+
130136
Add this bundle (and its dependencies, if they are not already added) to your
131137
application's kernel::
132138

@@ -250,6 +256,11 @@ routing configuration to enable the REST end point for saving content:
250256
$collection->addCollection($loader->import("@CmfCreateBundle/Resources/config/routing/rest.xml"));
251257
252258
return $collection;
259+
260+
.. tip::
261+
262+
If you don't want these routes to be prefixed by the current locale, you can
263+
use the ``@CmfCreateBundle/Resources/config/routing/rest_no_locale.xml`` file instead.
253264

254265
If you have the :doc:`MediaBundle <../media/index>` present in your project as well, you
255266
additionally need to register the route for the image upload handler:
@@ -500,7 +511,7 @@ Mapping Requests to Domain Objects
500511
One last piece is the mapping between CreatePHP data and the application
501512
domain objects. Data needs to be stored back into the database.
502513

503-
In version 1.0, the CreateBundle only provides a service to map to Doctrine
514+
Currently, the CreateBundle only provides a service to map to Doctrine
504515
PHPCR-ODM. If you do not enable the phpcr persistence layer, you need to
505516
configure the ``cmf_create.object_mapper_service_id``.
506517

@@ -513,14 +524,73 @@ configure the ``cmf_create.object_mapper_service_id``.
513524
CreatePHP would support specific mappers per RDFa type. If you need that, dig
514525
into the CreatePHP and CreateBundle and do a pull request to enable this feature.
515526

527+
Workflows
528+
---------
529+
530+
.. versionadded:: 1.1
531+
Support for workflows was introduced in CreateBundle 1.1.
532+
533+
CreateJS uses a REST api for creating, loading and changing content. To delete content
534+
the HTTP method DELETE is used. Since deleting might be a more complex operation
535+
than just removing the content form the storage (e.g. getting approval by another
536+
editor) there is no simple delete button in the user frontend. Instead, CreateJS and
537+
CreatePHP use "workflows" to implement that. This bundle comes with a simple implementation
538+
of a workflow to delete content. To enable the workflow set the config option 'delete' to true.
539+
540+
.. configuration-block::
541+
542+
.. code-block:: yaml
543+
544+
cmf_create:
545+
persistence:
546+
phpcr:
547+
delete: true
548+
549+
.. code-block:: xml
550+
551+
<?xml version="1.0" charset="UTF-8" ?>
552+
<container xmlns="http://symfony.com/schema/dic/services">
553+
<config xmlns="http://cmf.symfony.com/schema/dic/create">
554+
<persistence>
555+
<phpcr
556+
delete="true"
557+
>
558+
</phpcr>
559+
</persistence>
560+
</config>
561+
</container>
562+
563+
.. code-block:: php
564+
565+
$container->loadFromExtension('cmf_create', array(
566+
'persistence' => array(
567+
'phpcr' => array(
568+
'delete' => true,
569+
),
570+
),
571+
));
572+
573+
This results in the delete workflow being registered with CreatePHP and CreateJS so that
574+
you can now delete content from the frontend.
575+
576+
.. note::
577+
578+
The provided workflow supports PHPCR persistence only. It deletes the currently selected
579+
content once you confirmed deletion in the frontend. If the currently selected property is
580+
a property of the page the whole page is deleted.
581+
582+
In a more complex setup you need to create your own workflow instance, register it with CreatePHP
583+
and implement your logic in the workflows run method.
584+
585+
Currently the bundle only supports delete workflows but that will change in the future.
586+
516587
Read On
517588
-------
518589

519590
* :doc:`developing-hallo`
520591
* :doc:`other-editors`
521592
* :doc:`configuration`
522593

523-
524594
.. _`create.js`: http://createjs.org
525595
.. _`hallo.js`: http://hallojs.org
526596
.. _`CKEditor`: http://ckeditor.com/

bundles/create/other-editors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Then re-run composer:
3434

3535
.. code-block:: bash
3636
37-
$ php composer.phar run-scripts
37+
$ composer run-scripts
3838
3939
In your template, load the JavaScript files using:
4040

bundles/media/introduction.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ Installation
5959
cmf_media_image:
6060
resource: "@CmfMediaBundle/Resources/config/routing/image.xml"
6161
62+
_liip_imagine:
63+
resource: "@LiipImagineBundle/Resources/config/routing.xml"
64+
6265
.. code-block:: xml
6366
6467
<!-- app/config/routing.xml -->

bundles/menu/configuration.rst

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,68 @@ admin_recursive_breadcrumbs
180180
When editing a node, this setting will cause the Sonata admin breadcrumb to
181181
include ancestors of the node being edited.
182182

183+
Admin Extensions
184+
----------------
185+
186+
The ``admin_extensions`` section contains the configurations of the admin extensions that comes with the menu bundle.
187+
188+
menu_options
189+
~~~~~~~~~~~~
190+
191+
You can configure the menu options extension in this sections.
192+
193+
.. configuration-block::
194+
195+
.. code-block:: yaml
196+
197+
cmf_menu:
198+
# ...
199+
cmf_menu:
200+
admin_extensions:
201+
menu_options:
202+
enabled: auto
203+
advanced: false
204+
205+
.. code-block:: xml
206+
207+
<?xml version="1.0" charset="UTF-8" ?>
208+
<container xmlns="http://symfony.com/schema/dic/services">
209+
<config xmlns="http://cmf.symfony.com/schema/dic/menu">
210+
<admin_extensions>
211+
<menu_options
212+
enabled="auto"
213+
advanced="false"
214+
/>
215+
</admin_extensions>
216+
</config>
217+
</container>
218+
219+
.. code-block:: php
220+
221+
$container->loadFromExtension('cmf_menu', array(
222+
'admin_extensions' => array(
223+
'menu_options' => array(
224+
'enabled' => 'auto',
225+
'advanced' => false,
226+
),
227+
),
228+
),
229+
));
230+
231+
enabled
232+
"""""""
233+
**type**: ``enum`` **valid values**: ``true|false|auto`` **default**: ``auto``
234+
235+
If ``true``, the admin extension is activated. If set to ``auto``, it will be
236+
activated only if the SonataAdminBundle is present.
237+
238+
advanced
239+
""""""""
240+
**type**: ``boolean`` **default**: ``false``
241+
242+
if set to ``true`` it will expose the advanced options in the admin.
243+
To enable this options you need ``BurgovKeyValueFormBundle``
244+
183245
Voter
184246
-----
185247

0 commit comments

Comments
 (0)