/** * 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); }
/** * @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); }