/** * @param array $params * @return \Shopware\Models\Shop\Shop * @throws \Shopware\Components\Api\Exception\ValidationException * @throws \Exception */ public function create(array $params) { $this->checkPrivilege('create'); $params = $this->prepareShopData($params); $shop = new \Shopware\Models\Shop\Shop(); $shop->fromArray($params); $violations = $this->getManager()->validate($shop); if ($violations->count() > 0) { throw new ApiException\ValidationException($violations); } $this->getManager()->persist($shop); $this->flush(); return $shop; }