2016-09-01 10:15:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace EmotionHero\Models;
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
use JMS\Serializer\Annotation as JMS;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Users
|
|
|
|
*
|
2016-09-01 15:33:00 +00:00
|
|
|
* @ORM\Table(name="targets",uniqueConstraints={
|
|
|
|
* })
|
2016-09-01 10:15:17 +00:00
|
|
|
* @ORM\Entity
|
|
|
|
*/
|
|
|
|
class Target
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var integer
|
|
|
|
*
|
|
|
|
* @ORM\Column(name="id",type="integer")
|
|
|
|
* @ORM\Id
|
|
|
|
* @ORM\GeneratedValue
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
|
2016-09-01 15:33:00 +00:00
|
|
|
/**
|
|
|
|
* Incremental position in level
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $position;
|
2016-09-01 10:15:17 +00:00
|
|
|
|
|
|
|
/**
|
2016-09-01 15:33:00 +00:00
|
|
|
* @ORM\ManyToOne(targetEntity="Level", inversedBy="targets", cascade={"persist"})
|
2016-09-01 10:15:17 +00:00
|
|
|
* @ORM\JoinColumn(name="level_id", referencedColumnName="id", nullable=false)
|
|
|
|
*/
|
|
|
|
private $level;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var float
|
|
|
|
*/
|
|
|
|
private $time;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\ManyToOne(targetEntity="Emotion", inversedBy="targets")
|
|
|
|
* @ORM\JoinColumn(name="emotion_id", referencedColumnName="id", nullable=false)
|
|
|
|
*/
|
|
|
|
private $emotion;
|
|
|
|
|
2016-09-01 15:33:00 +00:00
|
|
|
/**
|
|
|
|
* Required score
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $score;
|
|
|
|
|
2016-09-01 10:15:17 +00:00
|
|
|
/**
|
|
|
|
* @ORM\OneToMany(targetEntity="Hit", mappedBy="target", fetch="EXTRA_LAZY")
|
|
|
|
*/
|
|
|
|
private $hits;
|
|
|
|
|
2016-09-01 15:33:00 +00:00
|
|
|
public function __construct(Level $level, int $position, Emotion $emotion, int $score, float $time)
|
2016-09-01 10:15:17 +00:00
|
|
|
{
|
|
|
|
$this->hits = new ArrayCollection();
|
2016-09-01 15:33:00 +00:00
|
|
|
$this->level = $level;
|
|
|
|
$this->emotion = $emotion;
|
|
|
|
$this->score = $score;
|
|
|
|
$this->time = $time;
|
|
|
|
$this->position = $position;
|
2016-09-01 10:15:17 +00:00
|
|
|
}
|
|
|
|
}
|