/** * Delete key value(s). * * @Post("/server/{serverId}/db/{dbId}/keys/values/delete", * requirements = {"serverId": "\d+", "dbId": "\d+"} * ) * @RequestParam(name="name", requirements=".+") * @RequestParam(name="type", requirements=".+") * @RequestParam(name="value", array=true) * @ParamConverter("key", converter="fos_rest.request_body", class="Eugef\PhpRedExpert\ApiBundle\Model\RedisKey") * @View() * * @param integer $serverId * @param integer $dbId * @param RedisKey $key * @throws HttpException * @return array */ public function deleteKeyValuesAction($serverId, $dbId, RedisKey $key) { $this->initialize($serverId, $dbId); if (!$key->validName()) { throw new HttpException(400, 'Key name is not specified'); } if (!$key->validType()) { throw new HttpException(400, 'Key type is invalid'); } if (!$key->hasValue('delete')) { throw new HttpException(400, 'Key values to be deleted are not specified'); } $result = $this->redis->deleteKeyValues($key); if ($result === false) { throw new HttpException(404, 'Key values are not deleted'); } return array('key' => $this->redis->getKey($key->getName())); }