public function feedbackAction(Request $request, $id, $feedback, $domain, $identifier)
    {
        $locale = substr($request->getLocale(), 0, 2);  // Make sure to use only the two character locale

        $om = $this->getObjectManager();
        $repository = $om->getRepository('TamagoTipsManagerBundle:TamagoTransUnitMeta');
        $tipMetaData = $repository->findOneBy(['lexikTransUnitId' => $id, 'locale' => $locale, 'identifier' => $identifier]);

        switch ($feedback) {
            case 'like':
                $tipMetaData->setLikes($tipMetaData->getLikes() + 1);
                break;
            case 'dislike':
                $tipMetaData->setDislikes($tipMetaData->getDislikes() + 1);
                break;
        }
        $om->flush();

        $transUnit = $this->getTipTransUnit($locale, $domain, $identifier);
        $translatedTip = $transUnit->getTranslation($locale);

        return $this->render('TamagoTipsManagerBundle:Default:tip.html.twig', [
            'tip' => $translatedTip, 'identifier' => $identifier
        ]);
    }
public function feedbackAction(Request $request, $id, $feedback, $domain, $identifier)
    {
        $locale = substr($request->getLocale(), 0, 2);  // Make sure to use only the two character locale

        $om = $this->getObjectManager();
        $repository = $om->getRepository('TamagoTipsManagerBundle:TamagoTransUnitMeta');
        $tipMetaData = $repository->findOneBy(['lexikTransUnitId' => $id, 'locale' => $locale, 'identifier' => $identifier]);

        switch ($feedback) {
            case 'like':
                $tipMetaData->setLikes($tipMetaData->getLikes() + 1);
                break;
            case 'dislike':
                $tipMetaData->setDislikes($tipMetaData->getDislikes() + 1);
                break;
        }
        $om->flush();

        $transUnit = $this->getTipTransUnit($locale, $domain, $identifier);
        $translatedTip = $transUnit->getTranslation($locale);

        return $this->render('TamagoTipsManagerBundle:Default:tip.html.twig', [
            'tip' => $translatedTip, 'identifier' => $identifier
        ]);
    }
public function feedbackAction ( Request $ request , $ id , $ feedback , $ domain , $ identifier ) { $ locale = substr ( $ request -> getLocale ( ) , 0 , 2 ) ; // Make sure to use only the two character locale $ om = $ this -> getObjectManager ( ) ; $ repository = $ om -> getRepository ( 'TamagoTipsManagerBundle:TamagoTransUnitMeta' ) ; $ tipMetaData = $ repository -> findOneBy ( [ 'lexikTransUnitId' => $ id , 'locale' => $ locale , 'identifier' => $ identifier ] ) ; switch ( $ feedback ) { case 'like' : $ tipMetaData -> setLikes ( $ tipMetaData -> getLikes ( ) + 1 ) ; break ; case 'dislike' : $ tipMetaData -> setDislikes ( $ tipMetaData -> getDislikes ( ) + 1 ) ; break ; } $ om -> flush ( ) ; $ transUnit = $ this -> getTipTransUnit ( $ locale , $ domain , $ identifier ) ; $ translatedTip = $ transUnit -> getTranslation ( $ locale ) ; return $ this -> render ( 'TamagoTipsManagerBundle:Default:tip.html.twig' , [ 'tip' => $ translatedTip , 'identifier' => $ identifier ] ) ; }
Record feedback for given tip and return a new tip div block to be rendered via jQuery.

@param Request $request
@param $id
@param $feedback
@param $domain
@param $identifier
@return Response
Record feedback for given tip and return a new tip div block to be rendered via jQuery .