Browse Source

Merge pull request #1486 from dbu/has-request

make hasRequest part of the AdminInterface
Thomas 12 years ago
parent
commit
57fc0373cc
3 changed files with 19 additions and 2 deletions
  1. 1 2
      Admin/Admin.php
  2. 8 0
      Admin/AdminInterface.php
  3. 10 0
      CHANGELOG.md

+ 1 - 2
Admin/Admin.php

@@ -2160,8 +2160,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
     }
 
     /**
-     *
-     * @return boolean true if the request object is linked to the Admin
+     * {@inheritdoc}
      */
     public function hasRequest()
     {

+ 8 - 0
Admin/AdminInterface.php

@@ -138,9 +138,17 @@ interface AdminInterface
 
     /**
      * @return \Symfony\Component\HttpFoundation\Request
+     *
+     * @throws \RuntimeException if no request is set.
      */
     public function getRequest();
 
+    /**
+     * @return boolean true if a request object is linked to this Admin, false
+     *      otherwise.
+     */
+    public function hasRequest();
+
     /**
      *
      * @return string

+ 10 - 0
CHANGELOG.md

@@ -10,6 +10,16 @@ CHANGELOG
       public function alterNewInstance(AdminInterface $admin, $object)
       {}
 
+* [BC BREAK] added hasRequest to the AdminInterface
+  If you do not extend the Admin class, you need to add a hasRequest method to
+  your admin like this (depending on how you handle the request you return in
+  getRequest:
+
+      public function hasRequest()
+      {
+          return null !== $this->request;
+      }
+
 ### 2013-07-05
 
 *  Remove qTip