point-tools/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php

29 lines
861 B
PHP
Raw Normal View History

2016-03-24 22:10:10 +00:00
<?php
namespace Skobkin\Bundle\PointToolsBundle\Controller;
use Skobkin\Bundle\PointToolsBundle\Entity\Blogs\Post;
use Skobkin\Bundle\PointToolsBundle\Service\UserApi;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\HttpFoundation\Response;
class PostController extends Controller
{
/**
* @ParamConverter("post", class="SkobkinPointToolsBundle:Blogs\Post")
*
* @return Response
*/
public function showAction(Post $post)
{
$userApi = $this->container->get('skobkin_point_tools.api_user');
return $this->render('SkobkinPointToolsBundle:Post:show.html.twig', [
'post' => $post,
'avatar_url' => $userApi->getAvatarUrl($post->getAuthor(), UserApi::AVATAR_SIZE_LARGE),
]);
}
}