Quellcode durchsuchen

Changed service name and namespace showing an up to date namespace example without referencing an existing class

Layton Everson vor 9 Jahren
Ursprung
Commit
948c8e0ade
1 geänderte Dateien mit 17 neuen und 17 gelöschten Zeilen
  1. 17 17
      Resources/doc/reference/architecture.rst

+ 17 - 17
Resources/doc/reference/architecture.rst

@@ -316,26 +316,26 @@ template files, administration panel title and logo.
 Create child admins
 -------------------
 
-Let us say you have a ``PostAdmin`` and a ``CommentAdmin``. You can optionally declare the ``CommentAdmin``
-to be a child of the ``PostAdmin``. This will create new routes like, for example, ``/post/{id}/comment/list``,
-where the comments will automatically be filtered by post.
+Let us say you have a ``PlaylistAdmin`` and a ``VideoAdmin``. You can optionally declare the ``VideoAdmin``
+to be a child of the ``PlaylistAdmin``. This will create new routes like, for example, ``/playlist/{id}/video/list``,
+where the videos will automatically be filtered by post.
 
-To do this, you first need to call the ``addChild`` method in your PostAdmin service configuration :
+To do this, you first need to call the ``addChild`` method in your ``PlaylistAdmin`` service configuration:
 
 .. configuration-block::
 
     .. code-block:: xml
 
         <!-- app/config/config.xml -->
-        <service id="sonata.news.admin.post" class="AppBundle\Admin\PostAdmin">
+        <service id="sonata.admin.playlist" class="AppBundle\Admin\PlaylistAdmin">
             <!-- ... -->
 
             <call method="addChild">
-                <argument type="service" id="sonata.news.admin.comment" />
+                <argument type="service" id="sonata.admin.video" />
             </call>
         </service>
 
-Then, you have to set the CommentAdmin ``parentAssociationMapping`` attribute to ``post`` :
+Then, you have to set the VideoAdmin ``parentAssociationMapping`` attribute to ``playlist`` :
 
 .. code-block:: php
 
@@ -345,19 +345,19 @@ Then, you have to set the CommentAdmin ``parentAssociationMapping`` attribute to
 
     // ...
 
-    class CommentAdmin extends AbstractAdmin
+    class VideoAdmin extends AbstractAdmin
     {
-        protected $parentAssociationMapping = 'post';
+        protected $parentAssociationMapping = 'playlist';
 
         // OR
 
         public function getParentAssociationMapping()
         {
-            return 'post';
+            return 'playlist';
         }
     }
 
-To display the ``CommentAdmin`` extend the menu in your ``PostAdmin`` class:
+To display the ``VideoAdmin`` extend the menu in your ``PlaylistAdmin`` class:
 
 .. code-block:: php
 
@@ -365,28 +365,28 @@ To display the ``CommentAdmin`` extend the menu in your ``PostAdmin`` class:
 
     namespace AppBundle\Admin;
 
-    class PostAdmin extends Admin
+    class PlaylistAdmin extends Admin
     {
         // ...
 
         protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
         {
             if (!$childAdmin && !in_array($action, array('edit', 'show'))) {
-
                 return;
             }
 
             $admin = $this->isChild() ? $this->getParent() : $this;
             $id = $admin->getRequest()->get('id');
 
-            $menu->addChild('Show Post', array('uri' => $admin->generateUrl('show', array('id' => $id))));
+            $menu->addChild('View Playlist', array('uri' => $admin->generateUrl('show', array('id' => $id))));
+
             if (is_granted('EDIT') {
-                $menu->addChild('Edit Post', array('uri' => $admin->generateUrl('edit', array('id' => $id))));
+                $menu->addChild('Edit Playlist', array('uri' => $admin->generateUrl('edit', array('id' => $id))));
             }
 
             if (is_granted('LIST', $admin) {
-                $menu->addChild('Manage Comments', array(
-                    'uri' => $admin->generateUrl('sonata.news.admin.comment.list', array('id' => $id))
+                $menu->addChild('Manage Videos', array(
+                    'uri' => $admin->generateUrl('sonata.admin.video.list', array('id' => $id))
                 ));
             }
         }