Esempio n. 1
0
 /**
  * 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));
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 public function testTranslationWriterChange()
 {
     $this->resource->setTranslationComponent(Shopware()->Models());
     $this->assertInstanceOf('Shopware\\Components\\Model\\ModelManager', $this->resource->getTranslationComponent());
 }
Esempio n. 4
0
 /**
  * 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()));
     }
 }