I have a problem with my router in Phalcon. I have an action in my controller which ether takes a date parameter or not. So when I access an URL: http://example.com/sl/slots/index/2017-06-27 everything works ok. But when I go to: http://example.com/sl/slots/index I get the following error:
DateTime::__construct(): Failed to parse time string (sl) at position 0 (s): The timezone could not be found in the database.
So the router actually takes the "sl" in the beginning as a parameter.
My router for this kind of url is set like this:
$router->add(
"/{language:[a-z]{2}}/:controller/:action",
array(
"controller" => 2,
"action" => 3
)
);
Btw it does the same withut the index: http://example.com/sl/slots
Oh and my slots index action looks like this:
public function indexAction($currentDate = false){ //code }
So the $currentDate is set to "sl" when I call the action without a parameter
Thank you for the help