I'm trying to get the ago datetime using KnpTimeBundle .
As the documentaion says , i need to use the helper class to acess to diff() function :
Take a look to my controller.php :
use Knp\Bundle\TimeBundle\Templating\Helper as Helper;
/**
* @Route("/test",name="test")
* @Method({"GET","POST"})
*/
public function testAction(Request $request){
$date = new \DateTime("now");
$h=new Helper();// here i got a 404 error
$ago=$h->diff($date);
return $this->render('test.html.twig', array());
}
But calling the Helper class by this way didnt work for me , can any one give me the right way to do the trick .