-
Notifications
You must be signed in to change notification settings - Fork 156
Various fixes for tutorial #562
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ node:: | |
|
||
public function init(ManagerRegistry $registry) | ||
{ | ||
$dm = $registry->getManagerForClass('Acme\BasicCmsBundle\Document\Site'); | ||
$dm = $registry->getManager(); | ||
if ($dm->find(null, $this->basePath)) { | ||
return; | ||
} | ||
|
@@ -135,8 +135,8 @@ node:: | |
documents in initializers. With 1.0, you would need to manually set the | ||
``phpcr:class`` property to the right value. | ||
|
||
Now modify the existing service configuration for ``GenericInitializer`` as | ||
follows: | ||
Now *remove* the old initializer service (``acme_basiccms.basic_cms.phpcr.initializer``) and | ||
register your new site initializer: | ||
|
||
.. configuration-block:: | ||
|
||
|
@@ -188,8 +188,6 @@ Now empty your repository, reinitialize it and reload your fixtures: | |
|
||
.. code-block:: bash | ||
|
||
$ php app/console doctrine:phpcr:node:remove /cms | ||
$ php app/console doctrine:phpcr:repository:init | ||
$ php app/console doctrine:phpcr:fixtures:load | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this was already the case in 1.1 |
||
|
||
and verify that the ``cms`` node has been created correctly, using the | ||
|
@@ -219,6 +217,83 @@ and verify that the ``cms`` node has been created correctly, using the | |
with the right class. The drawback then is that there are two places where | ||
initialization choices take place - do whatever you prefer. | ||
|
||
Reconfigure the Admin Tree | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section really highlights usablitiy problems with the Tree, which I guess we all know about. It took me some time to figure this out. It also highlights the risk of adding things earlier in the tutorial (i.e. adding the tree) which break later on. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i.e. everytime we add something to the tutorial, the tutorial needs to be tested manually from beginning to end. |
||
-------------------------- | ||
|
||
If you look at your admin interface now, you will notice that the tree has | ||
gone! | ||
|
||
You need to tell the admin tree about the new ``Site`` document which is now | ||
the root of your websites content tree: | ||
|
||
.. configuration-block:: | ||
|
||
.. code-block:: yaml | ||
|
||
sonata_doctrine_phpcr_admin: | ||
# ... | ||
document_tree: | ||
# ... | ||
Acme\BasicCmsBundle\Document\Site: | ||
valid_children: | ||
- all | ||
|
||
.. code-block:: xml | ||
|
||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<container xmlns="http://symfony.com/schema/dic/services"> | ||
|
||
<config xmlns="http://sonata-project.org/schema/dic/doctrine_phpcr_admin" /> | ||
|
||
<!-- ... --> | ||
|
||
<document-tree class="Acme\BasicCmsBundle\Document\Site"> | ||
<valid-child>all</valid-child> | ||
</document-tree> | ||
</config> | ||
</container> | ||
|
||
.. code-block:: php | ||
|
||
$container->loadFromExtension('sonata_doctrine_phpcr_admin', array( | ||
// ... | ||
'document_tree' => array( | ||
'Acme\BasicCmsBundle\Document\Site' => array( | ||
'valid_children' => array( | ||
'all', | ||
), | ||
), | ||
// ... | ||
)); | ||
|
||
If you check your admin interface you will see that the ``Site`` document is | ||
now being displayed, however it has no children. You need to map the children on the | ||
``Site`` document, modify it as follows:: | ||
|
||
// src/Acme/BasicCmsBundle/Document/Site.php | ||
|
||
// ... | ||
|
||
/** | ||
* @PHPCR\Document() | ||
*/ | ||
class Site | ||
{ | ||
/** | ||
* @PHPCR\Children() | ||
*/ | ||
protected $children; | ||
|
||
// ... | ||
|
||
public function getChildren() | ||
{ | ||
return $this->children; | ||
} | ||
} | ||
|
||
The tree should now again show your website structure. | ||
|
||
Create the Make Homepage Button | ||
------------------------------- | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just surplass to requirements..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean it makes things needlessly complex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah