public function save($object, array $translations)
    {
        $classStack = $this->getNamespacesFromClass(get_class($object));

        foreach ($classStack as $classNamespace) {
            if (!array_key_exists($classNamespace, $this->configuration)) {
                continue;
            }

            $configuration = $this->configuration[$classNamespace];
            $idGetter = $configuration['idGetter'];
            $entityId = $object->$idGetter();

            foreach ($translations as $locale => $translation) {
                foreach ($configuration['fields'] as $fieldName => $fieldConfiguration) {
                    if (isset($translation[$fieldName])) {
                        $this
                            ->entityTranslationProvider
                            ->setTranslation(
                                $configuration['alias'],
                                $entityId,
                                $fieldName,
                                $translation[$fieldName],
                                $locale
                            );
                    }
                }
            }
        }

        $this
            ->entityTranslationProvider
            ->flushTranslations();

        return $this;
    }
public function save($object, array $translations)
    {
        $classStack = $this->getNamespacesFromClass(get_class($object));

        foreach ($classStack as $classNamespace) {
            if (!array_key_exists($classNamespace, $this->configuration)) {
                continue;
            }

            $configuration = $this->configuration[$classNamespace];
            $idGetter = $configuration['idGetter'];
            $entityId = $object->$idGetter();

            foreach ($translations as $locale => $translation) {
                foreach ($configuration['fields'] as $fieldName => $fieldConfiguration) {
                    if (isset($translation[$fieldName])) {
                        $this
                            ->entityTranslationProvider
                            ->setTranslation(
                                $configuration['alias'],
                                $entityId,
                                $fieldName,
                                $translation[$fieldName],
                                $locale
                            );
                    }
                }
            }
        }

        $this
            ->entityTranslationProvider
            ->flushTranslations();

        return $this;
    }
public function save ( $ object , array $ translations ) { $ classStack = $ this -> getNamespacesFromClass ( get_class ( $ object ) ) ; foreach ( $ classStack as $ classNamespace ) { if ( ! array_key_exists ( $ classNamespace , $ this -> configuration ) ) { continue ; } $ configuration = $ this -> configuration [ $ classNamespace ] ; $ idGetter = $ configuration [ 'idGetter' ] ; $ entityId = $ object -> $ idGetter ( ) ; foreach ( $ translations as $ locale => $ translation ) { foreach ( $ configuration [ 'fields' ] as $ fieldName => $ fieldConfiguration ) { if ( isset ( $ translation [ $ fieldName ] ) ) { $ this -> entityTranslationProvider -> setTranslation ( $ configuration [ 'alias' ] , $ entityId , $ fieldName , $ translation [ $ fieldName ] , $ locale ) ; } } } } $ this -> entityTranslationProvider -> flushTranslations ( ) ; return $ this ; }
Saves object translations.

$translations = array(
'es' => array(
'name' => 'Nombre del producto',
'description' => 'Descripción del producto',
),
'fr' => array(
'name' => 'Nom du produit',
'description' => 'Description du produit',
),
);

@param object $object       Object
@param array  $translations Translations

@return $this Self object
Saves object translations .