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

Commit 707e34c

Browse files
committed
adjust to setParentDocument and mention SonataCoreBundle where needed. fix #425
1 parent b156145 commit 707e34c

File tree

12 files changed

+35
-33
lines changed

12 files changed

+35
-33
lines changed

book/database_layer.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class via annotations:
119119
/**
120120
* @PHPCR\ParentDocument()
121121
*/
122-
protected $parent;
122+
protected $parentDocument;
123123
}
124124
125125
.. code-block:: yaml
@@ -132,7 +132,7 @@ class via annotations:
132132
description: string
133133
done: boolean
134134
135-
parent_document: parent
135+
parent_document: parentDocument
136136
137137
.. code-block:: xml
138138
@@ -152,7 +152,7 @@ class via annotations:
152152
<field name="description" type="string" />
153153
<field name="done" type="boolean" />
154154
155-
<parent-document name="parent" />
155+
<parent-document name="parentDocument" />
156156
</document>
157157
158158
</doctrine-mapping>
@@ -207,7 +207,7 @@ AcmeTaskBundle::
207207

208208
$task = new Task();
209209
$task->setDescription('Finish CMF project');
210-
$task->setParent($rootTask);
210+
$task->setParentDocument($rootTask);
211211

212212
$documentManager->persist($task);
213213

book/routing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,12 @@ follows::
460460
public function load(ObjectManager $dm)
461461
{
462462
$route = new Route();
463-
$route->setParent($dm->find(null, '/cms/routes'));
463+
$route->setParentDocument($dm->find(null, '/cms/routes'));
464464
$route->setName('projects');
465465

466466
// link a content to the route
467467
$content = new StaticContent();
468-
$content->setParent($dm->find(null, '/cms/content'));
468+
$content->setParentDocument($dm->find(null, '/cms/content'));
469469
$content->setName('my-content');
470470
$dm->persist($content);
471471
$route->setRouteContent($content);

bundles/content/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ to multiple routes and menu items. A simple page can be created like this::
4444
$content->setTitle('Hello World');
4545
$content->setBody(...);
4646
$content->addRoute($route);
47-
$content->setParent($contentRoot);
47+
$content->setParentDocument($contentRoot);
4848
$content->setName('hello-world');
4949

5050
$documentManager->persist($content); // add the content

bundles/menu/introduction.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,22 @@ each of which specifies a URI::
5454
$menu = new Menu();
5555
$menu->setName('main-menu');
5656
$menu->setLabel('Main Menu');
57-
$menu->setParent($menuParent);
57+
$menu->setParentDocument($menuParent);
5858

5959
$manager->persist($menu);
6060

6161
$home = new MenuNode();
6262
$home->setName('home');
6363
$home->setLabel('Home');
64-
$home->setParent($menu);
64+
$home->setParentDocument($menu);
6565
$home->setUri('http://www.example.com/home');
6666

6767
$manager->persist($home);
6868

6969
$contact = new MenuNode();
7070
$contact->setName('contact');
7171
$contact->setLabel('Contact');
72-
$contact->setParent($menu);
72+
$contact->setParentDocument($menu);
7373
$contact->setUri('http://www.example.com/contact');
7474

7575
$manager->persist($contact);
@@ -118,11 +118,11 @@ example is specified. This will render an unordered list as follows:
118118
Sometimes, the menu is not located within the ``persistence.phpcr.menu_basepath``.
119119
In this case, you can use an absolute path (starting with a forward slash) to render
120120
the menu:
121-
121+
122122
.. configuration-block::
123123

124124
.. code-block:: jinja
125-
125+
126126
{{ knp_menu_render('/cms/some/path/my-menu') }}
127127
128128
.. code-block:: php
@@ -138,7 +138,7 @@ example is specified. This will render an unordered list as follows:
138138
.. note::
139139

140140
It is the ``PhpcrMenuProvider`` class which allows us to specify a
141-
PHPCR-ODM document as a menu. For more information see the
141+
PHPCR-ODM document as a menu. For more information see the
142142
:doc:`menu provider documentation <menu_provider>`.
143143

144144
.. caution::

bundles/menu/menu_documents.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Menu Documents
55
==============
66

7-
In accordance with the
7+
In accordance with the
88
:ref:`CMF bundle standards <contrib_bundles_baseandstandardimplementations>`
99
you are provided with two menu node implementations, a base document and a
1010
standard document.
@@ -24,7 +24,7 @@ the KnpMenu component documentation for more information.
2424
2525
// ODM specific
2626
$node = new MenuNodeBase();
27-
$node->setParent($parent);
27+
$node->setParentDocument($parent);
2828
$node->setName('home');
2929
3030
// Attributes are the HTML attributes of the DOM element representing the
@@ -49,7 +49,7 @@ the KnpMenu component documentation for more information.
4949
5050
// Specify a route name to use and the parameters to use with it
5151
$node->setRoute('my_hard_coded_route_name');
52-
$node->setRouteParameters(array());
52+
$node->setRouteParameters(array());
5353
5454
// Specify if the route should be rendered absolute (otherwise relative)
5555
$node->setRouteAbsolute(true);
@@ -111,12 +111,12 @@ Publish Workflow
111111
~~~~~~~~~~~~~~~~
112112

113113
The standard menu node implements ``PublishTimePeriodInterface`` and
114-
``PublishableInterface``. Please refer to the
114+
``PublishableInterface``. Please refer to the
115115
:doc:`publish workflow documentation <../core/publish_workflow>`.
116116

117117
.. versionadded:: 1.1
118118
The ``MenuContentVoter`` was added in CmfMenuBundle 1.1.
119-
119+
120120
The ``MenuContentVoter`` decides that a menu node is not published if the
121121
content it is pointing to is not published.
122122

cookbook/creating_a_cms/getting-started.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ to reduce code duplication::
137137
return $this->id;
138138
}
139139

140-
public function getParent()
140+
public function getParentDocument()
141141
{
142142
return $this->parent;
143143
}
144144

145-
public function setParent($parent)
145+
public function setParentDocument($parent)
146146
{
147147
$this->parent = $parent;
148148
}
@@ -377,7 +377,7 @@ Create a page for your CMS::
377377

378378
$page = new Page();
379379
$page->setTitle('Home');
380-
$page->setParent($parent);
380+
$page->setParentDocument($parent);
381381
$page->setContent(<<<HERE
382382
Welcome to the homepage of this really basic CMS.
383383
HERE
@@ -406,7 +406,7 @@ and add some posts::
406406
foreach (array('First', 'Second', 'Third', 'Forth') as $title) {
407407
$post = new Post();
408408
$post->setTitle(sprintf('My %s Post', $title));
409-
$post->setParent($parent);
409+
$post->setParentDocument($parent);
410410
$post->setContent(<<<HERE
411411
This is the content of my post.
412412
HERE

cookbook/creating_a_cms/sonata-admin.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ Enable the Sonata related bundles to your kernel::
2929
{
3030
$bundles = array(
3131
// ...
32-
new Sonata\BlockBundle\SonataBlockBundle(),
33-
new Sonata\jQueryBundle\SonatajQueryBundle(),
3432
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
33+
new Sonata\CoreBundle\SonataCoreBundle(),
34+
new Sonata\jQueryBundle\SonatajQueryBundle(),
35+
new Sonata\BlockBundle\SonataBlockBundle(),
3536
new Sonata\DoctrinePHPCRAdminBundle\SonataDoctrinePHPCRAdminBundle(),
3637
new Sonata\AdminBundle\SonataAdminBundle(),
37-
new Sonata\CoreBundle\SonataCoreBundle(),
3838
);
3939

4040
// ...
@@ -275,7 +275,7 @@ Create the following admin classes, first for the ``Page`` document::
275275
public function prePersist($document)
276276
{
277277
$parent = $this->getModelManager()->find(null, '/cms/pages');
278-
$document->setParent($parent);
278+
$document->setParentDocument($parent);
279279
}
280280

281281
protected function configureDatagridFilters(DatagridMapper $datagridMapper)

cookbook/creating_a_cms/the-frontend.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ to which you will add the existing ``Home`` page and an additional ``About`` pag
119119
// ...
120120
$rootPage = new Page();
121121
$rootPage->setTitle('main');
122-
$rootPage->setParent($parent);
122+
$rootPage->setParentDocument($parent);
123123
$dm->persist($rootPage);
124124

125125
$page = new Page();
126126
$page->setTitle('Home');
127-
$page->setParent($rootPage);
127+
$page->setParentDocument($rootPage);
128128
$page->setContent(<<<HERE
129129
Welcome to the homepage of this really basic CMS.
130130
HERE
@@ -133,7 +133,7 @@ to which you will add the existing ``Home`` page and an additional ``About`` pag
133133

134134
$page = new Page();
135135
$page->setTitle('About');
136-
$page->setParent($rootPage);
136+
$page->setParentDocument($rootPage);
137137
$page->setContent(<<<HERE
138138
This page explains what its all about.
139139
HERE

cookbook/creating_cms_using_cmf_and_sonata.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Next, initialize the bundles in ``app/AppKernel.php`` by adding them to the
6060

6161
// support for the admin
6262
new Symfony\Cmf\Bundle\TreeBrowserBundle\CmfTreeBrowserBundle(),
63+
new Sonata\CoreBundle\SonataCoreBundle(),
6364
new Sonata\jQueryBundle\SonatajQueryBundle(),
6465
new Sonata\BlockBundle\SonataBlockBundle(),
6566
new Sonata\AdminBundle\SonataAdminBundle(),

cookbook/editions/cmf_core.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Next, initialize the bundles in ``AppKernel.php`` by adding them to the
7373
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
7474

7575
// Dependencies of the CmfBlockBundle
76+
new Sonata\CoreBundle\SonataCoreBundle(),
7677
new Sonata\BlockBundle\SonataBlockBundle(),
7778
);
7879

0 commit comments

Comments
 (0)