Browse Source

use AdminInterface::createQuery() to retrieve Query object

Thomas Rabaix 13 years ago
parent
commit
d5bf0f1f03
2 changed files with 14 additions and 1 deletions
  1. 8 0
      Admin/Admin.php
  2. 6 1
      Admin/AdminInterface.php

+ 8 - 0
Admin/Admin.php

@@ -1127,6 +1127,14 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
         return $this->list;
     }
 
+    /**
+     * @return \Sonata\AdminBundle\Datagrid\ProxyQueryInterface
+     */
+    public function createQuery($context = 'list')
+    {
+        return $this->modelManager->createQuery($this->class);
+    }
+
     /**
      * Returns a list depend on the given $object
      *

+ 6 - 1
Admin/AdminInterface.php

@@ -113,6 +113,12 @@ interface AdminInterface
      */
     function getModelManager();
 
+    /**
+     * @abstract
+     * @return \Sonata\AdminBundle\Datagrid\ProxyQueryInterface
+     */
+    function createQuery($context = 'list');
+
     /**
      *
      * @return \Symfony\Component\Form\FormBuilder the form builder
@@ -197,7 +203,6 @@ interface AdminInterface
      */
     function addFilterFieldDescription($name, FieldDescriptionInterface $fieldDescription);
 
-
     /**
      * Returns a list depend on the given $object
      *