瀏覽代碼

doc update

Andrew Tch 13 年之前
父節點
當前提交
6cc98304ac
共有 1 個文件被更改,包括 23 次插入0 次删除
  1. 23 0
      Resources/doc/reference/filter_field_definition.rst

+ 23 - 0
Resources/doc/reference/filter_field_definition.rst

@@ -64,6 +64,29 @@ Example
         }
     }
 
+Timestamps
+----------
+
+``doctrine_orm_date``, ``doctrine_orm_date_range``, ``doctrine_orm_datetime`` and ``doctrine_orm_datetime_range`` support
+filtering of timestamp fields by specifying ``'input_type' => 'timestamp'`` option:
+
+.. code-block:: php
+
+    <?php
+    namespace Sonata\NewsBundle\Admin;
+
+    use Sonata\AdminBundle\Admin\Admin;
+    use Sonata\AdminBundle\Datagrid\DatagridMapper;
+
+    class PostAdmin extends Admin
+    {
+        protected function configureDatagridFilters(DatagridMapper $datagrid)
+        {
+            $datagrid
+                ->add('timestamp', 'doctrine_orm_datetime_range', array('input_type' => 'timestamp'));
+        }
+    }
+
 
 Advanced usage
 --------------