FilterInterface.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
  12. interface FilterInterface
  13. {
  14. /**
  15. * Apply the filter to the QueryBuilder instance
  16. *
  17. * @abstract
  18. * @param ProxyQueryInterface $queryBuilder
  19. * @param string $alias
  20. * @param string $field
  21. * @param string $value
  22. * @return void
  23. */
  24. function filter(ProxyQueryInterface $queryBuilder, $alias, $field, $value);
  25. /**
  26. * @abstract
  27. * @param $query
  28. * @param $value
  29. */
  30. function apply($query, $value);
  31. /**
  32. * Returns the filter name
  33. * @abstract
  34. * @return string
  35. */
  36. function getName();
  37. /**
  38. * Returns the label name
  39. *
  40. * @abstract
  41. * @return string
  42. */
  43. function getLabel();
  44. /**
  45. * @abstract
  46. *
  47. * @param string $label
  48. */
  49. function setLabel($name);
  50. /**
  51. * @abstract
  52. * @return array
  53. */
  54. function getDefaultOptions();
  55. /**
  56. * @abstract
  57. * @param string $name
  58. * @param null $default
  59. * @return mixed
  60. */
  61. function getOption($name, $default = null);
  62. /**
  63. * @abstract
  64. * @param $name
  65. * @param $value
  66. */
  67. function setOption($name, $value);
  68. /**
  69. * @abstract
  70. * @param $name
  71. * @param array $options
  72. * @return void
  73. */
  74. function initialize($name, array $options = array());
  75. /**
  76. * @abstract
  77. * @return string
  78. */
  79. function getFieldName();
  80. /**
  81. * @abstract
  82. * @return array
  83. */
  84. function getFieldOptions();
  85. /**
  86. * @abstract
  87. * @return string
  88. */
  89. function getFieldType();
  90. /**
  91. * Returns the main widget used to render the filter
  92. *
  93. * @abstract
  94. * @return array
  95. */
  96. function getRenderSettings();
  97. }