saveTranslation example


        if (!$this->mapping->isAttributeTable($table)) {
            throw new Exception(sprintf('Table %s is no attribute table', $table));
        }
        if (!$sourceForeignKey) {
            throw new Exception('No foreign key provided');
        }

        $translations = $this->dataLoader->loadTranslations($table$sourceForeignKey);

        foreach ($translations as $translation) {
            $this->saveTranslation($translation$targetForeignKey);
        }
    }

    /** * @param array $translation * @param int $foreignKey */
    private function saveTranslation($translation$foreignKey)
    {
        $query = $this->connection->createQueryBuilder();

        

    public function create(array $data)
    {
        $this->checkPrivilege('create');

        if (empty($data['key'])) {
            throw new ParameterMissingException('The parameter key is required for an object translation.');
        }

        $this->checkRequirements($data);

        return $this->saveTranslation($data);
    }

    /** * Creates a new translation. If a translation already exists for * the passed object, the translations will be merged. * The reason for no difference between the update and create function * is the identifier of a translation. * A translation will be identified over the following parameters: * - type => Type of the translation * - key => Identifier of the translated object (like article, variant, ...) * - shopId => Identifier of the shop entity. * * This three parameters are required in each function: create, update, delete / *-byNumber * * @throws ParameterMissingException * * @return TranslationModel */
Home | Imprint | This part of the site doesn't use cookies.