Util/DataGrid/DataGridRequestHandler.php
public function updateFromRequest($id, Request $request)
    {
        $transUnit = $this->storage->getTransUnitById($id);

        if (!$transUnit) {
            throw new NotFoundHttpException(sprintf('No TransUnit found for "%s"', $id));
        }

        $translationsContent = array();
        foreach ($this->localeManager->getLocales() as $locale) {
            $translationsContent[$locale] = $request->request->get($locale);
        }

        $this->transUnitManager->updateTranslationsContent($transUnit, $translationsContent);

        if ($transUnit instanceof TransUnitDocument) {
            $transUnit->convertMongoTimestamp();
        }

        $this->storage->flush();

        return $transUnit;
    }
public function updateFromRequest($id, Request $request)
    {
        $transUnit = $this->storage->getTransUnitById($id);

        if (!$transUnit) {
            throw new NotFoundHttpException(sprintf('No TransUnit found for "%s"', $id));
        }

        $translationsContent = array();
        foreach ($this->localeManager->getLocales() as $locale) {
            $translationsContent[$locale] = $request->request->get($locale);
        }

        $this->transUnitManager->updateTranslationsContent($transUnit, $translationsContent);

        if ($transUnit instanceof TransUnitDocument) {
            $transUnit->convertMongoTimestamp();
        }

        $this->storage->flush();

        return $transUnit;
    }
public function updateFromRequest ( $ id , Request $ request ) { $ transUnit = $ this -> storage -> getTransUnitById ( $ id ) ; if ( ! $ transUnit ) { throw new NotFoundHttpException ( sprintf ( 'No TransUnit found for "%s"' , $ id ) ) ; } $ translationsContent = array ( ) ; foreach ( $ this -> localeManager -> getLocales ( ) as $ locale ) { $ translationsContent [ $ locale ] = $ request -> request -> get ( $ locale ) ; } $ this -> transUnitManager -> updateTranslationsContent ( $ transUnit , $ translationsContent ) ; if ( $ transUnit instanceof TransUnitDocument ) { $ transUnit -> convertMongoTimestamp ( ) ; } $ this -> storage -> flush ( ) ; return $ transUnit ; }
Updates a trans unit from the request.

@param integer $id
@param Request $request
@throws NotFoundHttpException
@return \Lexik\Bundle\TranslationBundle\Model\TransUnit
Updates a trans unit from the request .