123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <?php
- /*
- * This file is part of the Sonata Project package.
- *
- * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Sonata\AdminBundle\Filter;
- use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
- /**
- * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
- */
- interface FilterInterface
- {
- const CONDITION_OR = 'OR';
- const CONDITION_AND = 'AND';
- /**
- * Apply the filter to the QueryBuilder instance.
- *
- * @param ProxyQueryInterface $queryBuilder
- * @param string $alias
- * @param string $field
- * @param string $value
- */
- public function filter(ProxyQueryInterface $queryBuilder, $alias, $field, $value);
- /**
- * @param mixed $query
- * @param mixed $value
- */
- public function apply($query, $value);
- /**
- * Returns the filter name.
- *
- * @return string
- */
- public function getName();
- /**
- * Returns the filter form name.
- *
- * @return string
- */
- public function getFormName();
- /**
- * Returns the label name.
- *
- * @return string|bool
- */
- public function getLabel();
- /**
- * @param string $label
- */
- public function setLabel($label);
- /**
- * @return array
- */
- public function getDefaultOptions();
- /**
- * @param string $name
- * @param null $default
- *
- * @return mixed
- */
- public function getOption($name, $default = null);
- /**
- * @param string $name
- * @param mixed $value
- */
- public function setOption($name, $value);
- /**
- * @param string $name
- * @param array $options
- */
- public function initialize($name, array $options = array());
- /**
- * @return string
- */
- public function getFieldName();
- /**
- * @return array of mappings
- */
- public function getParentAssociationMappings();
- /**
- * @return array field mapping
- */
- public function getFieldMapping();
- /**
- * @return array association mapping
- */
- public function getAssociationMapping();
- /**
- * @return array
- */
- public function getFieldOptions();
- /**
- * Get field option.
- *
- * @param string $name
- * @param null $default
- *
- * @return mixed
- */
- public function getFieldOption($name, $default = null);
- /**
- * Set field option.
- *
- * @param string $name
- * @param mixed $value
- */
- public function setFieldOption($name, $value);
- /**
- * @return string
- */
- public function getFieldType();
- /**
- * Returns the main widget used to render the filter.
- *
- * @return array
- */
- public function getRenderSettings();
- /**
- * Returns true if filter is active.
- *
- * @return bool
- */
- public function isActive();
- /**
- * Set the condition to use with the left side of the query : OR or AND.
- *
- * @param string $condition
- */
- public function setCondition($condition);
- /**
- * @return string
- */
- public function getCondition();
- /**
- * @return string
- */
- public function getTranslationDomain();
- }
|