FilterInterface.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Filter;
  11. use Symfony\Component\Form\FormFactory;
  12. interface FilterInterface
  13. {
  14. /**
  15. * Apply the filter to the QueryBuilder instance
  16. *
  17. * @abstract
  18. * @param $queryBuilder
  19. * @param string $alias
  20. * @param string $field
  21. * @param string $value
  22. * @return void
  23. */
  24. function filter($queryBuilder, $alias, $field, $value);
  25. /**
  26. * Define the related field builder
  27. *
  28. * @abstract
  29. * @param \Symfony\Component\Form\FormFactory
  30. * @return void
  31. */
  32. function defineFieldBuilder(FormFactory $formFactory);
  33. /**
  34. * Returns the filter name
  35. * @abstract
  36. * @return string
  37. */
  38. function getName();
  39. /**
  40. * Returns the formBuilder instance
  41. *
  42. * @abstract
  43. * @return \Symfony\Component\Form\FormBuilder
  44. */
  45. function getField();
  46. /**
  47. * @abstract
  48. * @return array
  49. */
  50. function getDefaultOptions();
  51. /**
  52. * @abstract
  53. * @param string $name
  54. * @param null $default
  55. * @return void
  56. */
  57. function getOption($name, $default = null);
  58. /**
  59. * @abstract
  60. * @return \Sonata\AdminBundle\Admin\FieldDescriptionInterface
  61. */
  62. function getFieldDescription();
  63. }