checked & co

This commit is contained in:
Maxime Renou 2019-02-22 19:25:42 +01:00
parent c56a5a8c58
commit 0456eeb339
1 changed files with 11 additions and 1 deletions

View File

@ -6,6 +6,7 @@ use Bluesquare\StorageBundle\Exceptions\MimeTypeException;
use Bluesquare\StorageBundle\Storage;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Contracts\Translation\TranslatorInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
class Validator
{
@ -172,7 +173,16 @@ class Validator
public function checked($field)
{
return !is_null($this->get($field)) || $this->get($field) != '0' || $this->get($field) != 0;
return $this->post() ? (
!is_null($this->get($field))
) : (
!is_null($this->value($field)) && $this->value($field) != 0 && $this->value($field) != false
);
}
public function isChecked($field)
{
return $this->has($field);
}
public function getFile($name)