FilterInterface.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 filter form name
  38. * @abstract
  39. * @return string
  40. */
  41. function getFormName();
  42. /**
  43. * Returns the label name
  44. *
  45. * @abstract
  46. * @return string
  47. */
  48. function getLabel();
  49. /**
  50. * @abstract
  51. *
  52. * @param string $label
  53. */
  54. function setLabel($name);
  55. /**
  56. * @abstract
  57. * @return array
  58. */
  59. function getDefaultOptions();
  60. /**
  61. * @abstract
  62. * @param string $name
  63. * @param null $default
  64. * @return mixed
  65. */
  66. function getOption($name, $default = null);
  67. /**
  68. * @abstract
  69. * @param $name
  70. * @param $value
  71. */
  72. function setOption($name, $value);
  73. /**
  74. * @abstract
  75. * @param $name
  76. * @param array $options
  77. * @return void
  78. */
  79. function initialize($name, array $options = array());
  80. /**
  81. * @abstract
  82. * @return string
  83. */
  84. function getFieldName();
  85. /**
  86. * @return array of mappings
  87. */
  88. function getParentAssociationMappings();
  89. /**
  90. * @abstract
  91. * @return array
  92. */
  93. function getFieldOptions();
  94. /**
  95. * @abstract
  96. * @return string
  97. */
  98. function getFieldType();
  99. /**
  100. * Returns the main widget used to render the filter
  101. *
  102. * @abstract
  103. * @return array
  104. */
  105. function getRenderSettings();
  106. }