public function createStoreAction() { $name = $this->getParam("name"); $config = Classificationstore\StoreConfig::getByName($name); if (!$config) { $config = new Classificationstore\StoreConfig(); $config->setName($name); $config->save(); } else { throw new \Exception("Store with the given name exists"); } $this->_helper->json(["success" => true, "storeId" => $config->getId()]); }