[CORE][Controller] Make Controller->{int,bool,string} functions return null if the GET parameter doesn't exist

This commit is contained in:
Hugo Sales 2022-01-01 20:03:40 +00:00
parent fc76a00908
commit acc84d757c
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 3 additions and 3 deletions

View File

@ -236,11 +236,11 @@ abstract class Controller extends AbstractController implements EventSubscriberI
{
switch ($method) {
case 'int':
return $this->request->query->getInt($args[0]);
return !$this->request->query->has($args[0]) ? null : $this->request->query->getInt($args[0]);
case 'bool':
return $this->request->query->getBoolean($args[0]);
return !$this->request->query->has($args[0]) ? null : $this->request->query->getBoolean($args[0]);
case 'string':
return $this->request->query->get($args[0]);
return !$this->request->query->has($args[0]) ? null : $this->request->query->get($args[0]);
case 'params':
return $this->request->query->all();
default: