public function delete($userId, $appId) { $app = $this->appTable->get($appId); if (!empty($app)) { if ($app['userId'] != $userId) { throw new StatusCode\BadRequestException('App does not belong to the user'); } $this->appService->delete($appId); } else { throw new StatusCode\NotFoundException('Could not find app'); } }
/** * Returns the DELETE response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doDelete($record) { $this->appService->delete((int) $this->getUriFragment('app_id')); return array('success' => true, 'message' => 'App successful deleted'); }