Prechádzať zdrojové kódy

use AdminInterface::createQuery() to retrieve Query object

Thomas Rabaix 13 rokov pred
rodič
commit
d5bf0f1f03
2 zmenil súbory, kde vykonal 14 pridanie a 1 odobranie
  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 $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
      * Returns a list depend on the given $object
      *
      *

+ 6 - 1
Admin/AdminInterface.php

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