Fix /me/games

This commit is contained in:
Ruben 2016-09-03 23:55:36 +01:00
parent 4fc05f2eb8
commit 37a14f567b
4 changed files with 26 additions and 3 deletions

View file

@ -77,20 +77,23 @@ class ScoreControllerProvider implements ControllerProviderInterface
// set game appends hit to game // set game appends hit to game
$hit->setGame($game); $hit->setGame($game);
$hit->setTarget($target);
$hit->setScore($data_hit['score']);
// attributes // attributes
$hit->setGlasses($data_hit['glasses']); $hit->setGlasses($data_hit['glasses']);
foreach(Models\Hit::$ATTRIBUTES as $attribute) { foreach(Models\Hit::$ATTRIBUTES as $attribute) {
$hit->setAttribute($data_hit[$attribute]); $hit->setAttribute($attribute, $data_hit[$attribute]);
} }
// emotions // emotions
foreach(Models\Hit::$EMOTIONS as $emotion) { foreach(Models\Hit::$EMOTIONS as $emotion) {
$hit->setEmotion($data_hit['emotions'][$emotion]); $hit->setEmotion($emotion, $data_hit['emotions'][$emotion]);
} }
//expressions //expressions
foreach(Models\Hit::$EXPRESSIONS as $expression) { foreach(Models\Hit::$EXPRESSIONS as $expression) {
$hit->setExpression($data_hit['expressions'][$expression]); $hit->setExpression($expression, $data_hit['expressions'][$expression]);
} }
//points //points

View file

@ -1657,6 +1657,12 @@ class Hit
return $this; return $this;
} }
public function setTarget(Target $target) {
$this->target = $target;
$target->addHit($this);
return $this;
}
/** /**
* Sets the value of score. * Sets the value of score.
* *

View file

@ -81,4 +81,14 @@ class Level
return $this; return $this;
} }
/**
* Gets the value of id.
*
* @return integer
*/
public function getId()
{
return $this->id;
}
} }

View file

@ -71,4 +71,8 @@ class Target
$this->time = $time; $this->time = $time;
$this->position = $position; $this->position = $position;
} }
public function addHit(Hit $hit){
$this->hits->add($hit);
}
} }