[CORE][Controller] Make Controller->{int,bool,string} functions return null if the GET parameter doesn't exist
This commit is contained in:
parent
fc76a00908
commit
acc84d757c
@ -236,11 +236,11 @@ abstract class Controller extends AbstractController implements EventSubscriberI
|
|||||||
{
|
{
|
||||||
switch ($method) {
|
switch ($method) {
|
||||||
case 'int':
|
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':
|
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':
|
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':
|
case 'params':
|
||||||
return $this->request->query->all();
|
return $this->request->query->all();
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user