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

Commit 9ed0555

Browse files
committed
started updating the tutorial
1 parent a89c438 commit 9ed0555

File tree

6 files changed

+48
-98
lines changed

6 files changed

+48
-98
lines changed
-7.37 KB
Binary file not shown.
-44.1 KB
Binary file not shown.

quick_tour/the_big_picture.rst

Lines changed: 17 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
The Big Picture
55
===============
66

7-
Start using the Symfony CMF in 10 minutes! This chapter will walk you through
7+
Start using the Symfony CMF in 10 minutes! This quick tour will walk you through
88
the base concepts of the Symfony CMF and get you started with it.
99

1010
It's important to know that the Symfony CMF is a collection of bundles which
@@ -13,7 +13,7 @@ Framework. Before you read further, you should at least have a basic knowledge
1313
of the Symfony Framework. If you don't know Symfony, start by reading the
1414
`Symfony Framework Quick Tour`_.
1515

16-
Solving the framework versus CMS dilemma
16+
Solving the Framework versus CMS Dilemma
1717
----------------------------------------
1818

1919
Before starting a new project, there is a difficult decision on whether it
@@ -25,12 +25,12 @@ the core parts of the CMS.
2525

2626
The CMF is created to solve this framework versus CMS dilemma. It provides
2727
bundles, so you can easily add CMS features to your project. But it also
28-
provides flexibility and in all cases you are using the framework, so you can
28+
provides flexibility and you can use the underlying Symfony framework to
2929
build custom functionality the way you want. This is called a `decoupled CMS`_.
3030

3131
The bundles provided by the Symfony CMF can work together, but they are also
3232
able to work standalone. This means that you don't need to add all bundles, you
33-
can decide to only use one of them (e.g. only the RoutingBundle or the MediaBundle).
33+
can decide to only use one of them (e.g. only the RoutingBundle or the SeoBundle).
3434

3535
Downloading the Symfony CMF Standard Edition
3636
--------------------------------------------
@@ -45,16 +45,8 @@ The best way to download the Symfony CMF Standard Edition is using Composer_:
4545

4646
.. code-block:: bash
4747
48-
$ composer create-project symfony-cmf/standard-edition cmf '1.2.1'
48+
$ composer create-project symfony-cmf/standard-edition cmf
4949
50-
.. note::
51-
52-
The `AcmeDemoBundle` that is used in this tour was removed in
53-
version 1.3 of the Symfony CMF Standard Edition. Since then it has
54-
become the skeleton for a simple CMS application. This is why we
55-
install version 1.2.1. If you insist on checking out the most
56-
recent versions of the CMF, check out `symfony-cmf/cmf-sandbox`.
57-
5850
Setting up the Database
5951
~~~~~~~~~~~~~~~~~~~~~~~
6052

@@ -63,7 +55,7 @@ something you are used to doing when creating Symfony applications, but the
6355
Symfony CMF needs a database in order to make a lot of things configurable
6456
using an admin interface.
6557

66-
To quickly get started, it is expected that you have enabled the sqlite
58+
To quickly get started, it is expected that you have enabled the sqlite PHP
6759
extension. After that, run these commands:
6860

6961
.. code-block:: bash
@@ -88,9 +80,11 @@ The Request Flow
8880

8981
.. tip::
9082

91-
When you have at least PHP 5.4, use the ``server:run`` command to run a
92-
local server for the demo. Otherwise, use a ``localhost`` and prefix the URLs
93-
in this document with ``/path-to-project/web/app_dev.php/``.
83+
Use the ``server:run`` command to run a local server for the demo. If you
84+
use a web server like Nginx or Apache, you need to prefix the URLs
85+
in this document with ``app_dev.php/`` (and the path to the ``web`` folder
86+
inside the Symfony project, if that is not already the root folder of your
87+
server).
9488

9589
Now, the Standard Edition is ready to use. Navigate to the homepage
9690
(``http://localhost:8000/``) to see the demo:
@@ -175,13 +169,15 @@ Adding a New Page
175169

176170
Now you know the request flow, you can start adding a new page. In the Symfony
177171
CMF Standard Edition, the data is stored in data files, which are loaded when
178-
executing the ``doctrine:phpcr:fixtures:load`` command. To add a new page, you
179-
just need to edit such a data file, which is located in the
180-
``src/Acme/DemoBundle/Resources/data`` directory:
172+
executing the ``doctrine:phpcr:fixtures:load`` command. To add a new page, edit
173+
one of the data files located in the
174+
``src/AppBundle/Resources/data`` directory:
175+
176+
TODO: replace example, simplecms bundle is not maintained anymore
181177

182178
.. code-block:: yaml
183179
184-
# src/Acme/DemoBundle/Resources/data/pages.yml
180+
# src/AppBundle/Resources/data/pages.yml
185181
Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page:
186182
# ...
187183
@@ -196,28 +192,6 @@ the changes on the database and after refreshing, you can see your new page!
196192

197193
.. image:: ../_images/quick_tour/big-picture-new-page.png
198194

199-
Live Editing
200-
------------
201-
202-
Now is the time you become an admin of this site and editing the content using
203-
the Web Interface. To do this click on "Admin Login" and use the provided
204-
credentials.
205-
206-
You'll see that you have a new bar at the top of the page:
207-
208-
.. image:: ../_images/quick_tour/big-picture-createjs-bar.png
209-
210-
This bar is generated by the `Create.js`_ library. The Symfony CMF integrates
211-
the CreatePHP_ and `Create.js`_ libraries using a CreateBundle. This enables
212-
you to edit a page using a full WYSIWYG editor when you are reading the page.
213-
214-
Now you can change the content of our new page using Create.js:
215-
216-
.. image:: ../_images/quick_tour/big-picture-edit-page.png
217-
218-
After clicking "save", the changes are saved using the CreateBundle and the
219-
content is updated.
220-
221195
Final Thoughts
222196
--------------
223197

quick_tour/the_model.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ of the CMF.
1111
.. note::
1212

1313
Again, this chapter is talking about the PHPCR storage layer. But the CMF
14-
is storage agnostically created, meaning it is not tied to specific storage
15-
system.
14+
is written in a storage agnostic way, meaning it is not tied to specific
15+
storage system.
1616

1717
Getting Familiar with PHPCR
1818
---------------------------
@@ -85,10 +85,10 @@ a page by using a yaml file which was parsed by the SimpleCmsBundle. This
8585
time, you'll create a page by doing it yourself.
8686

8787
First, you have to create a new DataFixture to add your new page. You do this
88-
by creating a new class in the AcmeDemoBundle::
88+
by creating a new class in the AppBundle::
8989

90-
// src/Acme/DemoBundle/DataFixtures/PHPCR/LoadPageData.php
91-
namespace Acme\DemoBundle\DataFixtures\PHPCR;
90+
// src/AppBundle/DataFixtures/PHPCR/LoadPageData.php
91+
namespace AppBundle\DataFixtures\PHPCR;
9292

9393
use Doctrine\Common\Persistence\ObjectManager;
9494
use Doctrine\Common\DataFixtures\FixtureInterface;

quick_tour/the_router.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,39 +135,39 @@ new routes in ``/cms/routes``:
135135
.. code-block:: php
136136
137137
// app/config/config.php
138-
$container->loadFromExtension('cmf_routing', array(
139-
'chain' => array(
140-
'routers_by_id' => array(
138+
$container->loadFromExtension('cmf_routing', [
139+
'chain' => [
140+
'routers_by_id' => [
141141
// the standard DynamicRouter
142142
'cmf_routing.dynamic_router' => 200,
143143
144144
// the core symfony router
145145
'router.default' => 100,
146-
),
147-
),
148-
'dynamic' => array(
149-
'persistence' => array(
150-
'phpcr' => array(
146+
],
147+
],
148+
'dynamic' => [
149+
'persistence' => [
150+
'phpcr' => [
151151
'route_basepaths' => '/cms/routes',
152-
),
152+
],
153153
/* /cms/routes is the default base path, the above code is
154154
equivalent to:
155155
'phpcr' => true,
156156
*/
157-
),
158-
),
159-
));
157+
],
158+
],
159+
]);
160160
161161
Now you can add a new ``Route`` to the tree using Doctrine::
162162

163-
// src/Acme/DemoBundle/DataFixtures/PHPCR/LoadRoutingData.php
164-
namespace Acme\DemoBundle\DataFixtures\PHPCR;
163+
// src/AppBundle/DataFixtures/PHPCR/LoadRoutingData.php
164+
namespace AppBundle\DataFixtures\PHPCR;
165165

166166
use Doctrine\Common\Persistence\ObjectManager;
167167
use Doctrine\Common\DataFixtures\FixtureInterface;
168168
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
169169
use Doctrine\ODM\PHPCR\DocumentManager;
170-
170+
171171
use PHPCR\Util\NodeHelper;
172172

173173
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
@@ -178,14 +178,14 @@ Now you can add a new ``Route`` to the tree using Doctrine::
178178
{
179179
return 20;
180180
}
181-
181+
182182
public function load(ObjectManager $documentManager)
183183
{
184184
if (!$documentManager instanceof DocumentManager) {
185185
$class = get_class($documentManager);
186186
throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given.");
187187
}
188-
188+
189189
$session = $documentManager->getPhpcrSession();
190190
NodeHelper::createPath($session, '/cms/routes');
191191

@@ -205,7 +205,7 @@ Now you can add a new ``Route`` to the tree using Doctrine::
205205
$documentManager->flush(); // save it
206206
}
207207
}
208-
208+
209209
Above we implemented the ``OrderedFixtureInterface`` so that our routes were loaded in the correct sequence relative to other fixtures.
210210

211211
Now execute the ``doctrine:phpcr:fixtures:load`` command again.

quick_tour/the_third_party_bundles.rst

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ AcmeDemoBundle:
1919

2020
.. code-block:: html+jinja
2121

22-
<!-- src/Acme/DemoBundle/Resources/views/layout.html.twig -->
22+
<!-- app/Resources/views/layout.html.twig -->
2323

2424
<!-- ... -->
2525
<nav class="navbar navbar-inverse page__nav" role="navigation">
@@ -46,32 +46,6 @@ contains all items implementing the ``NodeInterface`` inside the
4646
provides Admin classes. See the section about `Sonata Admin`_ to learn
4747
more about this.
4848

49-
The CreateBundle
50-
----------------
51-
52-
You've already seen this bundle in the first chapter. This bundle integrates
53-
the CreatePHP_ library (which uses the `Create.js`_ library) into Symfony2
54-
using the FOSRestBundle_.
55-
56-
The Create.js library works using a REST layer. All elements on a page get
57-
`RDFa Mappings`_, which tells Create.js how to map the element to the document.
58-
When you save the page, the new content is passed to the REST api and saved in
59-
the database.
60-
61-
Rendering content with RDFa mappings can be very easy, as you can see in the
62-
Standard Edition:
63-
64-
.. code-block:: html+jinja
65-
66-
{% block main %}
67-
{% createphp cmfMainContent as="rdf" %}
68-
{{ rdf|raw }}
69-
{% endcreatephp %}
70-
{% endblock %}
71-
72-
This will output the content object using `<div>` elements. You can also
73-
customize this completely by using the ``createphp_*`` functions.
74-
7549
The BlockBundle
7650
---------------
7751

@@ -86,9 +60,9 @@ used blocks.
8660

8761
The three blocks in the Standard Edition are custom blocks. A block is handled
8862
by a block service. You can find this service in the
89-
``Acme\DemoBundle\Block\UnitBlockService`` class. Since the blocks are
63+
``AppBundle\Block\UnitBlockService`` class. Since the blocks are
9064
persisted using PHPCR, it also needs a block document, which is located in
91-
``Acme\DemoBundle\Document\UnitBlock``.
65+
``AppBundle\Document\UnitBlock``.
9266

9367
The SeoBundle
9468
-------------
@@ -106,11 +80,11 @@ both the CMF and the Sonata bundle in the ``AppKernel``::
10680
// ...
10781
public function registerBundles()
10882
{
109-
$bundles = array(
83+
$bundles = [
11084
// ...
11185
new Sonata\SeoBundle\SonataSeoBundle(),
11286
new Symfony\Cmf\Bundle\SeoBundle\CmfSeoBundle(),
113-
);
87+
];
11488
// ...
11589
}
11690

@@ -126,7 +100,7 @@ the CmfSeoBundle can extract the title from a content object:
126100
The ``%%content_title%%`` will be replaced by the title extracted from the
127101
content object. The last thing you need to do is using this title as the title
128102
element. To do this, replace the ``<title>`` tag line in the
129-
``src/Acme/DemoBundle/Resources/views/layout.html.twig`` template with this:
103+
``src/AppBundle/Resources/views/layout.html.twig`` template with this:
130104

131105
.. code-block:: html+jinja
132106

@@ -157,6 +131,8 @@ more SEO information.
157131
Sonata Admin
158132
------------
159133

134+
TODO: rewrite for sonata admin integration split out
135+
160136
We have explained you that the CMF is based on a database, in order to make it
161137
editable by an admin without changing the code. But we haven't told you how
162138
that admin will be able to maintain the website. Now it's time to reveal how

0 commit comments

Comments
 (0)