FilterInterface.php 1.9 KB

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