Skip to content

Instantly share code, notes, and snippets.

@slave2zeros
Created July 31, 2012 17:28
Show Gist options
  • Save slave2zeros/3218724 to your computer and use it in GitHub Desktop.
Save slave2zeros/3218724 to your computer and use it in GitHub Desktop.
public function deleteStepUser($outputFormat=null)
{
$this->before($outputFormat);
$data = $this->convertInput($this->getDataSource());
$this->checkData($data);
$this->checkStep($data);
$this->checkUser($data);
$goalStepUser = GoalStepUser::findByDql('step_id = ? AND user_id = ? AND team_id IS NULL', array($data['GoalStep']['id'], $data['User']['id']))->getFirst();
if ($goalStepUser) {
$goalStepUser->delete();
return $this->output('User step successfully deleted');
} else {
return $this->output('User is not associated with this step', null, self::HTTP_BAD_REQUEST);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment