-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce search with SearchFilterType (#14)
- Loading branch information
Showing
8 changed files
with
125 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kreyu\Bundle\DataTableBundle\Filter\Type; | ||
|
||
use Kreyu\Bundle\DataTableBundle\Filter\FilterData; | ||
use Kreyu\Bundle\DataTableBundle\Filter\FilterInterface; | ||
use Kreyu\Bundle\DataTableBundle\Query\ProxyQueryInterface; | ||
use Symfony\Component\Form\Extension\Core\Type\SearchType; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
class SearchFilterType extends AbstractFilterType implements SearchFilterTypeInterface | ||
{ | ||
public function apply(ProxyQueryInterface $query, FilterData $data, FilterInterface $filter, array $options): void | ||
{ | ||
$options['handler']($query, (string) $data->getValue(), $filter); | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver | ||
->setDefaults([ | ||
'field_type' => SearchType::class, | ||
'operator_options' => [ | ||
'visible' => false, | ||
'choices' => [], | ||
] | ||
]) | ||
->setRequired('handler') | ||
->setAllowedTypes('handler', 'callable') | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kreyu\Bundle\DataTableBundle\Filter\Type; | ||
|
||
interface SearchFilterTypeInterface extends FilterTypeInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters