function destroy($params) { if (empty($params['id'])) { bail('Required parameter "id" is missing.'); } $hour = new Hour($params['id']); $project_id = $hour->getProject()->id; $hour->destroy(); $this->redirectTo(array('controller' => 'Project', 'action' => 'show', 'id' => $project_id)); }