gregosphatos/doctrine-filters-bundle
最新稳定版本:1.0.2
Composer 安装命令:
composer require gregosphatos/doctrine-filters-bundle
包简介
Some nice doctrine filters
README 文档
README
DoctrineFiltersBundle provides integration for DoctrineFilters for your Symfony2 Project.
Installation
With composer :
Install composer on Linux / Mac OS
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
To install composer on Windows download the installer from getcomposer.org/download, execute it and follow the instructions.
Add this on your composer.json
"require": { "gregosphatos/doctrine-filters-bundle": "~1.0" }
Documentation
Record state filter
This filter is really usefull for all db recordset that need to be statued (active, inactive). Available for Doctrine ORM and Doctrine mongo ODM :
in your config.yml :
orm: entity_managers: # Your own entity manager collection some_em: filters: state_filter: class: GreGosPhaTos\DoctrineFiltersBundle\Doctrine\Filter\ORM\RecordStateFilter enabled: true
or
doctrine_mongodb: document_managers: # Your own document manager collection some_dm: filters: state_filter: class: GreGosPhaTos\DoctrineFiltersBundle\Doctrine\Filter\ODM\RecordStateFilter enabled: true
Manually add the configurator in your service.yml :
services: # ORM acme.doctrine.orm.filter.configurator: class: GreGosPhaTos\DoctrineFiltersBundle\Doctrine\Filter\ORM\Configurator arguments: - "@doctrine.orm.entity_manager" - "@annotation_reader" tags: - { name: kernel.event_listener, event: kernel.request } # ODM acme.doctrine.odm.filter.configurator: class: GreGosPhaTos\DoctrineFiltersBundle\Doctrine\Filter\ODM\Configurator arguments: - "@doctrine_mongodb.odm.document_manager" - "@annotation_reader" tags: - { name: kernel.event_listener, event: kernel.request }
Change your entities or documents :
use GreGosPhaTos\DoctrineFiltersBundle\Doctrine\Annotation\RecordState; /** * Entity. * * @RecordState(stateFieldName="state", activeValue="active") */ class MyEntity { /** * Record state * possible values : active, inactive */ private $state; }
Then all the queries will be filter to get only the active records.
统计信息
- 总下载量: 3.51k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-27