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

Commit cc93870

Browse files
committed
Merge remote-tracking branch 'origin/1.2'
Conflicts: book/routing.rst bundles/create/developing-hallo.rst
2 parents 6235232 + 79af13e commit cc93870

File tree

12 files changed

+126
-60
lines changed

12 files changed

+126
-60
lines changed

book/database_layer.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class via annotations:
131131
132132
.. code-block:: yaml
133133
134-
# src/Acme/TaskBundle/Resources/config/doctrine/Task.odm.yml
134+
# src/Acme/TaskBundle/Resources/config/doctrine/Task.phpcr.yml
135135
Acme\TaskBundle\Document\Task:
136136
id: id
137137
@@ -143,7 +143,7 @@ class via annotations:
143143
144144
.. code-block:: xml
145145
146-
<!-- src/Acme/TaskBundle/Resources/config/doctrine/Task.odm.xml -->
146+
<!-- src/Acme/TaskBundle/Resources/config/doctrine/Task.phpcr.xml -->
147147
<?xml version="1.0" encoding="UTF-8" ?>
148148
<doctrine-mapping
149149
xmlns="http://doctrine-project.org/schemas/phpcr-odm/phpcr-mapping"
@@ -261,7 +261,7 @@ you've configured a route to display a specific task by name::
261261
public function showAction($name)
262262
{
263263
$repository = $this->get('doctrine_phpcr')->getRepository('AcmeTaskBundle:Task');
264-
$task = $repository->find('/task/'.$name);
264+
$task = $repository->find('/tasks/'.$name);
265265

266266
if (!$task) {
267267
throw $this->createNotFoundException('No task found with name '.$name);

book/installation.rst

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,17 @@ dependencies, use the ``install`` command:
9696
9797
$ composer install
9898
99+
To try out things, you can accept the default values for all questions you are
100+
asked about the parameters.yml. Revisit that file later when you know more
101+
about Jackalope.
102+
103+
Setup
104+
-----
105+
106+
You are almost there. A few more steps need to be done to be ready.
99107

100108
Set up the Database
101-
-------------------
109+
~~~~~~~~~~~~~~~~~~~
102110

103111
The next step is to set up the database. If you want to use SQLite as your
104112
database backend just go ahead and run the following:
@@ -115,7 +123,20 @@ folder, containing the database content. The two commands after it will setup
115123
PHPCR and the final command will load some fixtures, so you can access the
116124
Standard Edition using a web server.
117125

118-
The project should now be accessible on your web server. If you have PHP 5.4
126+
Preparing Assetic
127+
~~~~~~~~~~~~~~~~~
128+
129+
To use the frontend editing in ``prod`` environment, you need to tell Assetic
130+
to dump the assets to the filesystem:
131+
132+
.. code-block:: bash
133+
134+
$ php app/console --env=prod assetic:dump
135+
136+
Configure a Webserver
137+
~~~~~~~~~~~~~~~~~~~~~
138+
139+
The project is now ready to be served by your web server. If you have PHP 5.4
119140
installed you can alternatively use the PHP internal web server:
120141

121142
.. code-block:: bash
@@ -128,7 +149,6 @@ And then access the CMF via:
128149
129150
http://localhost:8000
130151
131-
132152
If you run an Apache installation as described in the `Symfony cookbook article on setup`_,
133153
your URL will look like this:
134154

book/routing.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,10 @@ follows::
478478
$content = new StaticContent();
479479
$content->setParentDocument($dm->find(null, '/cms/content'));
480480
$content->setName('my-content');
481+
$content->setTitle('My Content');
482+
$content->setBody('Some Content');
481483
$dm->persist($content);
482-
$route->setRouteContent($content);
484+
$route->setContent($content);
483485

484486
// now define an id parameter; do not forget the leading slash if you
485487
// want /projects/{id} and not /projects{id}
@@ -505,7 +507,7 @@ also ``/projects`` as there is a default for the id parameter.
505507
doing it in a fixture like this).
506508

507509
Because you defined the ``{id}`` route parameter, your controller can expect an
508-
``$id`` parameter. Additionally, because you called ``setRouteContent`` on the
510+
``$id`` parameter. Additionally, because you called ``setContent`` on the
509511
route, your controller can expect the ``$contentDocument`` parameter.
510512
The content could be used to define an intro section that is the same for each
511513
project or other shared data. If you don't need content, you can just not set it

bundles/block/create_your_own_blocks.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ that knows how to fetch the feed data of an ``RssBlock``::
136136
public function execute(BlockContextInterface $blockContext, Response $response = null)
137137
{
138138
$block = $blockContext->getBlock();
139-
139+
140140
if (!$block->getEnabled()) {
141141
return new Response();
142142
}
@@ -145,7 +145,7 @@ that knows how to fetch the feed data of an ``RssBlock``::
145145
$settings = $blockContext->getSettings();
146146
$resolver = new OptionsResolver();
147147
$resolver->setDefaults($settings);
148-
$settings = $resolver->resolve($block->getOptions());
148+
$settings = $resolver->resolve($block->getSettings());
149149

150150
$feeds = false;
151151
if ($settings['url']) {
@@ -291,7 +291,7 @@ on the current page:
291291

292292
This mechanism is not recommended. For optimal load times, it is better
293293
to have a central assets definition for your project and aggregate them
294-
into a single Stylesheet and a single JavaScript file, e.g. with assetic_,
294+
into a single Stylesheet and a single JavaScript file, e.g. with Assetic_,
295295
rather than having individual ``<link>`` and ``<script>`` tags for each
296296
single file.
297297

@@ -341,4 +341,4 @@ handles, as per the ``getType`` method of the block. The second argument is the
341341
->addTag('sonata.block')
342342
;
343343
344-
.. _assetic: http://symfony.com/doc/current/cookbook/assetic/asset_management.html
344+
.. _Assetic: http://symfony.com/doc/current/cookbook/assetic/asset_management.html

bundles/create/developing-hallo.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ To use this template, specify ``hallo-coffee`` as editor in the
3434
))
3535
) ?>
3636
37-
The hallo-coffee template uses assetic to load the coffee script files from
37+
The hallo-coffee template uses Assetic to load the coffee script files from
3838
``Resources/public/vendor/hallo/src``, rather than the pre-compiled JavaScript
3939
from ``Resources/public/vendor/create/deps/hallo-min.js``. This also means
40-
that you need to add a mapping for coffeescript in your assetic configuration
40+
that you need to add a mapping for coffeescript in your Assetic configuration
4141
and you need the `coffee compiler set up correctly`_.
4242

4343
.. configuration-block::

bundles/create/introduction.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ You also need to configure the FOSRestBundle to handle json:
194194
));
195195
196196
If you want to use Assetic to combine the CSS and JavaScript used for
197-
create.js, you need to enable the CreateBundle in the assetic configuration.
198-
Find the configuration for ``assetic.bundles``. If it is not present, assetic
197+
create.js, you need to enable the CreateBundle in the Assetic configuration.
198+
Find the configuration for ``assetic.bundles``. If it is not present, Assetic
199199
automatically scans all bundles for assets and you don't need to do anything.
200200
If you limit the bundles, you need to add ``CmfCreateBundle`` to the list of
201201
bundles.
@@ -227,6 +227,14 @@ bundles.
227227
),
228228
));
229229
230+
If you were not using Assetic previously, you need to call the ``assetic:dump``
231+
command in your deployment process, or the Javascript and CSS files will not be
232+
found:
233+
234+
.. code-block:: bash
235+
236+
$ php app/console --env=prod assetic:dump
237+
230238
Routing
231239
~~~~~~~
232240

@@ -256,7 +264,7 @@ routing configuration to enable the REST end point for saving content:
256264
$collection->addCollection($loader->import("@CmfCreateBundle/Resources/config/routing/rest.xml"));
257265
258266
return $collection;
259-
267+
260268
.. tip::
261269

262270
If you don't want these routes to be prefixed by the current locale, you can
@@ -350,7 +358,7 @@ after those to be able to customize as needed) with:
350358
351359
.. caution::
352360

353-
Make sure assetic is rewriting the paths in your CSS files properly or you
361+
Make sure Assetic is rewriting the paths in your CSS files properly or you
354362
might not see icon images.
355363

356364
In your page bottom area, load the JavaScript files. If you are using Symfony 2.2 or

bundles/seo/configuration.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ Can be one of ``canonical`` or ``redirect``.
100100

101101
**type**: ``string`` **default**: ``null`` (or ``DynamicRouter::CONTENT_KEY`` when RoutingBundle is enabled)
102102

103-
The name of the Request attribute which contains the content object. This is
104-
required when the RoutingBundle is not enabled, otherwise it defaults to
105-
``DynamicRouter::CONTENT_KEY`` (which evaluates to ``contentDocument``).
103+
The name of the request attribute which contains the content object. This is
104+
used by the ContentListener to exctract SEO information automatically. If the
105+
RoutingBundle is present, this defaults to ``DynamicRouter::CONTENT_KEY``
106+
(which evaluates to ``contentDocument``), otherwise you must define this
107+
manually.
106108

107109
``sonata_admin_extension``
108110
~~~~~~~~~~~~~~~~~~~~~~~~~~

bundles/seo/introduction.rst

Lines changed: 61 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ Both the CmfSeoBundle and SonataSeoBundle must be registered in the
3232
Usage
3333
~~~~~
3434

35+
SEO data tracks some or all of the following:
36+
37+
* The title;
38+
* The meta keywords;
39+
* The meta description;
40+
* The original URL (when more than one URL contains the same content).
41+
* Anything else that uses the ``<meta>`` tag with the ``property``, ``name``
42+
or ``http-equiv`` type (e.g. Open Graph data).
43+
3544
The simplest use of this bundle would be to just set some configuration to the
3645
``sonata_seo`` configuration section and use the twig helper in your templates.
3746

@@ -62,8 +71,12 @@ The simplest use of this bundle would be to just set some configuration to the
6271
),
6372
),
6473
));
65-
66-
The only thing to do now is to use the twig helper in your templates:
74+
75+
This sets default values for the ``SeoPage`` value object. You can later update
76+
that object with more precise information. It is available as service
77+
``sonata.seo.page.default``.
78+
79+
To render the information, use the following twig functions in your templates:
6780

6881
.. code-block:: html+jinja
6982

@@ -80,54 +93,73 @@ The only thing to do now is to use the twig helper in your templates:
8093
</body>
8194
</html>
8295

83-
This will render a page with the default title ("Page's default title") as
84-
title element. The information defined for description and keywords will go
85-
into the correct metatags.
96+
This will render the last title set on the ``SeoPage`` ("Page's default title"
97+
if you did not add calls to the value object in your code). The information
98+
added for description and keywords will render as ``<meta>`` HTML tags.
8699

87100
.. seealso::
88101

89102
To get a deeper look into the SonataSeoBundle, you should visit the
90103
`Sonata documentation`_.
91104

92-
Using SeoMetadata
93-
-----------------
105+
Using the CmfSeoBundle
106+
----------------------
94107

95108
The basic example shown above works perfectly without the CmfSeoBundle. The
96-
CmfSeoBundle provides more extension points to configure the SEO data with
97-
data from the document (e.g. a ``StaticContent`` document). This is done by
98-
using SEO metadata. This is SEO data which will be used for a particular
99-
document. This metadata can hold:
109+
CmfSeoBundle provides extension points to extract the SEO data from
110+
content documents, e.g. a ``StaticContent``, along with utility systems
111+
to automatically extract the information.
100112

101-
* The title;
102-
* The meta keywords;
103-
* The meta description;
104-
* The original URL (when more than one URL contains the same content).
105-
* Anything else that uses the ``<meta>`` tag with the ``property``, ``name``
106-
or ``http-equiv`` type (e.g. Open Graph data).
113+
The process is:
114+
115+
1. The content listener checks for a document in the request
116+
2. It invokes ``SeoPresentationInterface::updateSeoPage``
117+
3. The presentation checks of the document provides a ``SeoMetadata`` value
118+
object and runs the metadata extractors.
119+
4. The presentation updates the Sonata ``SeoPage`` with the gathered meta data.
120+
121+
.. _bundles-seo-content-listener:
107122

108-
The content object is retrieved from the request attributes. By default, it
109-
uses the ``DynamicRouter::CONTENT_KEY`` constant when the
110-
:doc:`RoutingBundle <../routing/introduction>` is installed. To change this,
111-
or if you don't use the RoutingBundle, you can configure it with
123+
The ContentListener
124+
~~~~~~~~~~~~~~~~~~~
125+
126+
The ``Symfony\Cmf\Bundle\SeoBundle\EventListener\ContentListener`` looks for a
127+
content document in the request attributes. If it finds a document, it calls
128+
``SeoPresentationInterface::updateSeoPage``.
129+
130+
If the :doc:`RoutingBundle <../routing/introduction>` is installed, the default
131+
attribute name is defined by the constant ``DynamicRouter::CONTENT_KEY``. When
132+
not using the RoutingBundle, you need to configure a key in
112133
``cmf_seo.content_key``.
113-
This bundle provides two ways of using this metadata:
134+
135+
Extracting Metadata
136+
~~~~~~~~~~~~~~~~~~~
137+
138+
A service implementing ``SeoPresentationInterface`` is responsible for
139+
determining metadata from an object and updating the Sonata ``SeoPage`` with that
140+
information. A default implementation is provided as ``cmf_seo.presentation``.
141+
142+
Defining Metadata
143+
~~~~~~~~~~~~~~~~~
144+
145+
This bundle provides two ways to define metadata on objects:
114146

115147
#. Implementing the ``SeoAwareInterface`` and persisting the ``SeoMetadata``
116148
with the object.
117-
#. Using the extractors, to extract the ``SeoMetadata`` from already existing
118-
values (e.g. the title of the page).
149+
#. Using ``ExtractorInterface`` instances, to extract the ``SeoMetadata`` from
150+
already existing values (e.g. the title of the page).
119151

120152
You can also combine both ways, even on the same document. In that case, the
121153
persisted ``SeoMetadata`` can be changed by the extractors, to add or tweak
122154
the current available SEO information. For instance, if you are writing a
123155
``BlogPost`` class, you want the SEO keywords to be set to the tags/category
124-
of the post and any additional tags set by the admin.
156+
of the post and any additional tags set by the editor.
125157

126-
Persisting the ``SeoMetadata`` with the document makes it easy to edit for the
127-
admin, while using the extractors are perfect to easily use values from the
128-
displayed content.
158+
Persisting the ``SeoMetadata`` with the document makes it easy to override SEO
159+
information for the editor, while using the extractors adds the convenience
160+
that values from the normal content of the document can be reused.
129161

130-
Both ways are documented in detail in separate sections:
162+
Both methods are documented in detail in separate sections:
131163

132164
* :doc:`seo_aware`
133165
* :doc:`extractors`

components/routing/dynamic.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ for your content in three ways:
201201
* Or provide an implementation of ``ContentRepositoryInterface`` and pass the id
202202
of the content object as parameter ``content_id`` and ``null`` as $name.
203203

204-
If you want to implement your own generator for ``$name``s that are not
204+
If you want to implement your own generator for ``$name`` values that are not
205205
strings, you need to implement the ``ChainedRouterInterface`` and implement the
206206
``supports($name)`` method to tell the ``ChainRouter`` if your router can
207207
accept this ``$name`` to generate a URL.

cookbook/editions/cmf_sandbox.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ The sandbox should now be accessible on your web server.
158158
http://localhost/app_dev.php
159159
160160
In order to run the sandbox in production mode you need to generate the
161-
doctrine proxies and dump the assetic assets:
161+
doctrine proxies and dump the Assetic assets:
162162

163163
.. code-block:: text
164164

0 commit comments

Comments
 (0)