예제 #1
0
 /**
  * Create new translation
  *
  * POST /api/translations
  */
 public function postAction()
 {
     $useNumberAsId = (bool) $this->Request()->getParam('useNumberAsId', 0);
     $params = $this->Request()->getPost();
     if ($useNumberAsId) {
         $translation = $this->resource->createByNumber($params);
     } else {
         $translation = $this->resource->create($params);
     }
     $location = $this->apiBaseUrl . 'translations/' . $translation['id'];
     $data = array('id' => $translation['id'], 'location' => $location);
     $this->View()->assign(array('success' => true, 'data' => $data));
     $this->Response()->setHeader('Location', $location);
 }
예제 #2
0
 /**
  * @expectedException \Shopware\Components\Api\Exception\NotFoundException
  */
 public function testInvalidConfiguratorOptionWithOptionName()
 {
     $data = $this->getDummyData('configuratoroption');
     $entity = $this->getConfiguratorOptionName();
     $name = explode('|', $entity['name']);
     $name[1] = $name[1] . '-INVALID';
     $name = implode('|', $name);
     $data['key'] = $name;
     $this->resource->createByNumber($data);
 }