From b3c436140951b597c8ff7a452f177564db464155 Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 1 Sep 2016 17:05:47 +0100 Subject: [PATCH] Fix models --- src/Models/Game.php | 15 +- src/Models/Hit.php | 493 +++++++++++++++++++++++++++++++++--------- src/Models/Level.php | 1 + src/Models/Target.php | 3 + 4 files changed, 414 insertions(+), 98 deletions(-) diff --git a/src/Models/Game.php b/src/Models/Game.php index 6fe4289..cc36308 100644 --- a/src/Models/Game.php +++ b/src/Models/Game.php @@ -42,7 +42,10 @@ class Game */ private $hits; - /** @var float Total score of the game (sum of hits) */ + /** + * @ORM\Column + * @var Total score + */ private $score; /** @@ -53,6 +56,16 @@ class Game */ private $createdAt; + public function __construct() + { + $this->hits = new ArrayCollection(); + } + + public function addHit(Hit $hit) { + $this->hits->add($hit); + $this->score += $hit->getScore(); + } + /** * Gets the value of id. * diff --git a/src/Models/Hit.php b/src/Models/Hit.php index 1643392..d17aab6 100644 --- a/src/Models/Hit.php +++ b/src/Models/Hit.php @@ -38,6 +38,7 @@ class Hit /** * @var float The score this hit resulted in + * @ORM\Column */ private $score; @@ -62,204 +63,493 @@ class Hit /** * @var boolean + * @ORM\Column */ private $glasses; - /** @var float Head roll angle */ + /** + * @var float Head roll angle + * @ORM\Column + */ private $roll; - /** @var float Head pitch angle */ + /** + * @var float Head pitch angle + * @ORM\Column + */ private $pitch; - /** @var float Head yaw angle */ + /** + * @var float Head yaw angle + * @ORM\Column + */ private $yaw; - /** @var float Distance between two outer eye corners (mm?) */ + /** + * @var float Distance between two outer eye corners (mm?) + * @ORM\Column + */ private $inter_ocular_distance; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $mouth_open; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $lip_press; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $brow_raise; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $nose_wrinkler; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $lip_depressor; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $brow_furrow; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $attention; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $smile; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $inner_brow_raiser; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $chin_raiser; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $smirk; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $lip_suck; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $upper_lip_raiser; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $lip_pucker; - /** @var float Expression parameter */ + /** + * @var float Expression parameter + * @ORM\Column + */ private $eye_closure; - /** @var float 'Expression' parameter */ + /** + * @var float 'Expression' parameter + * @ORM\Column + */ private $engagement; - /** @var float 'Expression' parameter */ + /** + * @var float 'Expression' parameter + * @ORM\Column + */ private $valence; - /** @var float Emotion parameter */ + /** + * @var float Emotion parameter + * @ORM\Column + */ private $anger; - /** @var float Emotion parameter */ + /** + * @var float Emotion parameter + * @ORM\Column + */ private $contempt; - /** @var float Emotion parameter */ + /** + * @var float Emotion parameter + * @ORM\Column + */ private $disgust; - /** @var float Emotion parameter */ + /** + * @var float Emotion parameter + * @ORM\Column + */ private $fear; - /** @var float Emotion parameter */ + /** + * @var float Emotion parameter + * @ORM\Column + */ private $joy; - /** @var float Emotion parameter */ + /** + * @var float Emotion parameter + * @ORM\Column + */ private $sadness; - /** @var float Emotion parameter */ + /** + * @var float Emotion parameter + * @ORM\Column + */ private $surprise; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_0x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_0y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_1x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_1y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_2x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_2y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_3x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_3y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_4x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_4y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_5x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_5y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_6x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_6y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_7x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_7y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_8x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_8y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_9x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_9y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_10x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_10y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_11x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_11y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_12x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_12y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_13x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_13y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_14x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_14y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_15x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_15y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_16x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_16y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_17x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_17y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_18x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_18y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_19x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_19y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_20x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_20y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_21x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_21y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_22x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_22y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_23x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_23y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_24x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_24y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_25x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_25y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_26x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_26y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_27x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_27y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_28x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_28y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_29x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_29y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_30x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_30y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_31x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_31y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_32x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_32y; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_33x; - /** @var float Facial landmark */ + /** + * @var float Facial landmark + * @ORM\Column + */ private $point_33y; /* @@ -303,9 +593,18 @@ class Hit */ - public function __construct() { $this->hits = new ArrayCollection(); } + + /** + * Gets the value of score. + * + * @return float The score this hit resulted in + */ + public function getScore() + { + return $this->score; + } } diff --git a/src/Models/Level.php b/src/Models/Level.php index 0bb372f..55d11b5 100644 --- a/src/Models/Level.php +++ b/src/Models/Level.php @@ -26,6 +26,7 @@ class Level /** * Name of the level * @var string + * @ORM\Column */ private $name; diff --git a/src/Models/Target.php b/src/Models/Target.php index fc5e51c..ab9ff46 100644 --- a/src/Models/Target.php +++ b/src/Models/Target.php @@ -27,6 +27,7 @@ class Target /** * Incremental position in level * @var int + * @ORM\Column */ private $position; @@ -38,6 +39,7 @@ class Target /** * @var float + * @ORM\Column */ private $time; @@ -50,6 +52,7 @@ class Target /** * Required score * @var int + * @ORM\Column */ private $score;