public function ratingAction(Request $request)
    {
        $arrData  = $request->request->get('data');
        $fltValue = $request->request->get('rating');

        if (!($arrData && $arrData['id'] && $arrData['pid'] && $arrData['item'])) {
            $this->bail('Invalid request.');
        }

        $objMetaModel = $this->factory->getMetaModel($this->factory->translateIdToMetaModelName($arrData['pid']));
        if (!$objMetaModel) {
            $this->bail('No MetaModel.');
        }

        /** @var Rating $objAttribute */
        $objAttribute = $objMetaModel->getAttributeById($arrData['id']);

        if (!$objAttribute) {
            $this->bail('No Attribute.');
        }

        $objAttribute->addVote($arrData['item'], (float) $fltValue, true);

        return new Response();
    }
public function ratingAction(Request $request)
    {
        $arrData  = $request->request->get('data');
        $fltValue = $request->request->get('rating');

        if (!($arrData && $arrData['id'] && $arrData['pid'] && $arrData['item'])) {
            $this->bail('Invalid request.');
        }

        $objMetaModel = $this->factory->getMetaModel($this->factory->translateIdToMetaModelName($arrData['pid']));
        if (!$objMetaModel) {
            $this->bail('No MetaModel.');
        }

        /** @var Rating $objAttribute */
        $objAttribute = $objMetaModel->getAttributeById($arrData['id']);

        if (!$objAttribute) {
            $this->bail('No Attribute.');
        }

        $objAttribute->addVote($arrData['item'], (float) $fltValue, true);

        return new Response();
    }
public function ratingAction ( Request $ request ) { $ arrData = $ request -> request -> get ( 'data' ) ; $ fltValue = $ request -> request -> get ( 'rating' ) ; if ( ! ( $ arrData && $ arrData [ 'id' ] && $ arrData [ 'pid' ] && $ arrData [ 'item' ] ) ) { $ this -> bail ( 'Invalid request.' ) ; } $ objMetaModel = $ this -> factory -> getMetaModel ( $ this -> factory -> translateIdToMetaModelName ( $ arrData [ 'pid' ] ) ) ; if ( ! $ objMetaModel ) { $ this -> bail ( 'No MetaModel.' ) ; } /** @var Rating $objAttribute */ $ objAttribute = $ objMetaModel -> getAttributeById ( $ arrData [ 'id' ] ) ; if ( ! $ objAttribute ) { $ this -> bail ( 'No Attribute.' ) ; } $ objAttribute -> addVote ( $ arrData [ 'item' ] , ( float ) $ fltValue , true ) ; return new Response ( ) ; }
Process an ajax request.

@param Request $request The current request.

@return Response
Process an ajax request .