mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Check if status code is OK
This commit is contained in:
parent
e10e6ab34e
commit
d215273c65
2 changed files with 24 additions and 0 deletions
|
@ -11,6 +11,7 @@ use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\CheckboxFilterType;
|
|||
use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
|
||||
|
@ -91,6 +92,18 @@ class EntryFilterType extends AbstractType
|
|||
'label' => 'entry.filters.domain_label',
|
||||
])
|
||||
->add('httpStatus', TextFilterType::class, [
|
||||
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
|
||||
$value = $values['value'];
|
||||
if (false === array_key_exists($value, Response::$statusTexts)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$paramName = sprintf('%s', str_replace('.', '_', $field));
|
||||
$expression = $filterQuery->getExpr()->eq($field, ':'.$paramName);
|
||||
$parameters = array($paramName => $value);
|
||||
|
||||
return $filterQuery->createCondition($expression, $parameters);
|
||||
},
|
||||
'label' => 'entry.filters.http_status_label',
|
||||
])
|
||||
->add('isArchived', CheckboxFilterType::class, [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue