/** * Delete translation * * DELETE /api/translation/{id} */ public function deleteAction() { $id = $this->Request()->getParam('id'); $data = $this->Request()->getParams(); $useNumberAsId = (bool) $this->Request()->getParam('useNumberAsId', 0); if ($useNumberAsId) { $this->resource->deleteByNumber($id, $data); } else { $this->resource->delete($id, $data); } $this->View()->assign(array('success' => true)); }
public function createUnitTranslations(array $unitIds, $shopId, array $translation = array()) { $data = array('type' => 'config_units', 'key' => 1, 'shopId' => $shopId, 'data' => array()); foreach ($unitIds as $id) { if (isset($translation[$id])) { $data['data'][$id] = array_merge($this->getUnitTranslation(), $translation[$id]); } else { $data['data'][$id] = $this->getUnitTranslation(); } } $this->translationApi->create($data); }
public function testTranslationWriterChange() { $this->resource->setTranslationComponent(Shopware()->Models()); $this->assertInstanceOf('Shopware\\Components\\Model\\ModelManager', $this->resource->getTranslationComponent()); }
/** * Create the TS-Article translation * * @param ArticleModel $articleModel * @param bool $isUpdate * @throws ParameterMissingException */ private function createArticleTranslation(ArticleModel $articleModel, $isUpdate = false) { /* @var Translation $translationResource */ $translationResource = new Translation(); $translationResource->setManager($this->em); if ($isUpdate) { $translationResource->update($articleModel->getId(), $this->getTranslationArray()); } else { $translationResource->create(array_merge(array('key' => $articleModel->getId()), $this->getTranslationArray())); } }