Closed
Description
Hi,
Type error: Argument 1 passed to OC\PlatformBundle\Controller\AdvertController::indexAction() must be of the type integer, string given
This error has been catched when you have defined default value to a parameter of a route, and type in the url banner /platform/ .
Normally /platform/ equals to /platform but with PHP 7 not.
when you use php5 there is no problem
see the code >>
routing.yml
oc_platform_home:
path: /platform/{page}
defaults:
_controller: OCPlatformBundle:Advert:index
page: 1
requirements:
page: \d*
AdvertController.php
public function indexAction(int $page) : Response
{
if($page < 1){
throw new NotFoundHttpException("Page $page inexistante");
}
return $this->render('OCPlatformBundle:Advert:index.html.twig');
}