FilterInterface.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. * @param ProxyQueryInterface $queryBuilder
  18. * @param string $alias
  19. * @param string $field
  20. * @param string $value
  21. *
  22. * @return void
  23. */
  24. public function filter(ProxyQueryInterface $queryBuilder, $alias, $field, $value);
  25. /**
  26. * @param mixed $query
  27. * @param mixed $value
  28. */
  29. public function apply($query, $value);
  30. /**
  31. * Returns the filter name
  32. *
  33. * @return string
  34. */
  35. public function getName();
  36. /**
  37. * Returns the filter form name
  38. *
  39. * @return string
  40. */
  41. public function getFormName();
  42. /**
  43. * Returns the label name
  44. *
  45. * @return string
  46. */
  47. public function getLabel();
  48. /**
  49. * @param string $label
  50. */
  51. public function setLabel($label);
  52. /**
  53. * @return array
  54. */
  55. public function getDefaultOptions();
  56. /**
  57. * @param string $name
  58. * @param null $default
  59. *
  60. * @return mixed
  61. */
  62. public function getOption($name, $default = null);
  63. /**
  64. * @param string $name
  65. * @param mixed $value
  66. */
  67. public function setOption($name, $value);
  68. /**
  69. * @param string $name
  70. * @param array $options
  71. *
  72. * @return void
  73. */
  74. public function initialize($name, array $options = array());
  75. /**
  76. * @return string
  77. */
  78. public function getFieldName();
  79. /**
  80. * @return array of mappings
  81. */
  82. public function getParentAssociationMappings();
  83. /**
  84. * @return array field mapping
  85. */
  86. public function getFieldMapping();
  87. /**
  88. * @return array association mapping
  89. */
  90. public function getAssociationMapping();
  91. /**
  92. * @return array
  93. */
  94. public function getFieldOptions();
  95. /**
  96. * @return string
  97. */
  98. public function getFieldType();
  99. /**
  100. * Returns the main widget used to render the filter
  101. *
  102. * @return array
  103. */
  104. public function getRenderSettings();
  105. }