I'm working on a symfony site and it continue to goes down almost every day so I have to clear the cache and chmod all cache folder content to solve the problem.
Clearing the cache is the quick solution that I had but sometimes it doesn't do the job.
Also I figured that the site doesn't completely crash,it still working for some user but not for others (they call me to fix the problem but when I access the site it work for me)
In the prod log file I get an error that I do not understand:
[2015-10-08 16:43:18] request.INFO: Matched route "product". {"route_parameters":{"_controller":"FM\FmBundle\Controller\HomeController::productAction","_route":"product"},"request_uri":"https://first1-market.com/product/puma-pu102601002u"} []
[2015-10-08 16:43:18] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2015-10-08 16:43:18] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "FM\FmBundle\Controller\HomeController::productAction()" requires that you provide a value for the "$product_slug" argument (because there is no default value or because there is a non optional argument after this one)." at /home/firstmarlo/app/cache/prod/classes.php line 2595 {"exception":"[object] (RuntimeException(code: 0): Controller \"FM\FmBundle\Controller\HomeController::productAction()\" requires that you provide a value for the \"$product_slug\" argument (because there is no default value or because there is a non optional argument after this one). at /home/firstmarlo/app/cache/prod/classes.php:2595)"} []
the product route
product:
path: /product/{product_slug}
defaults: { _controller: FMFmBundle:Home:product }
the product Action
public function productAction($product_slug)
{
$product=$this->getDoctrine()->getEntityManager()->getRepository('FMFmBundle:Products')->findOneBy(array('slug'=>$product_slug));
$collection=$product->getCategory()->getCollection();
return $this->render('FMFmBundle:Product:index.html.twig',array('product'=>$product,'color'=>$collection->getColor()));
}
the link to this action
{% for product in FmarketProductService.getRecommanded() %}
<a href="{{ url('product',{'product_slug': product.slug})}}">
this work fine but I don't Know why I'm getting this error in the log file and why the site goes done
Any idea or a workaround to solve this problem?
public function productAction($product_slug = null)
) then check and return something if it receivesnull
. – xurshid29