<?php
namespace Neag\UtilitesBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class BBCodeController extends ParsingController {

    /**
     * @Route("/preview")
     */
    public function previewAction(Request $request)
    {
        $data = $request->request->get('data');
        $data = html_entity_decode(stripslashes($data),ENT_QUOTES,'UTF-8');

        $globals = $this->get('globals');
        $content = $globals->parseBBCode($data, 'comment');

        return new Response($content);
    }

}