Created
July 18, 2014 07:36
-
-
Save kamaulynder/b0a86cee99506593b527 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function interact(Tag $tag, TagData $input) | |
{ | |
if ($input->role) | |
{ | |
$role = $input->role; | |
$input->role = json_encode($role); | |
} | |
// We only want to work with values that have been changed | |
$update = $input->getDifferent($tag->asArray()); | |
if (!$this->valid->check($update)) | |
throw new ValidatorException("Failed to validate tag", $this->valid->errors()); | |
// Determine what changes to make in the tag | |
$this->updated = $update->asArray(); | |
$this->repo->updateTag($tag->id, $this->updated); | |
// Reflect the changes in the tag | |
$tag->setData($this->updated); | |
return $tag; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment