try achievements
This commit is contained in:
parent
322c883422
commit
5541b5b563
2 changed files with 41 additions and 1 deletions
|
@ -37,6 +37,19 @@ foreach($queries as $sql){ echo "$sql;\n"; }
|
||||||
$tool->updateSchema($classes);
|
$tool->updateSchema($classes);
|
||||||
|
|
||||||
|
|
||||||
|
// add achievements
|
||||||
|
for ($i=1; $i < 10; $i++) {
|
||||||
|
$achievement = $em->getRepository(EmotionHero\Models\Achievement::class)->find($i);
|
||||||
|
if(empty($achievement))
|
||||||
|
{
|
||||||
|
$achievement = new EmotionHero\Models\Achievement($i);
|
||||||
|
$achievement->setTitle("zomaar iets #".$i);
|
||||||
|
$em->persist($achievement);
|
||||||
|
$em->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
die();
|
die();
|
||||||
// ADD EMOTIONS
|
// ADD EMOTIONS
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,17 @@ class Game
|
||||||
*/
|
*/
|
||||||
private $originalGameAt;
|
private $originalGameAt;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ArrayCollection[Achievements]
|
||||||
|
* @ORM\ManyToMany(targetEntity="Achievement", cascade={"persist"})
|
||||||
|
* @ORM\JoinTable(name="games_achievements",
|
||||||
|
* joinColumns={@ORM\JoinColumn(name="game_id", referencedColumnName="id")},
|
||||||
|
* inverseJoinColumns={@ORM\JoinColumn(name="achievement_id", referencedColumnName="id")}
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
private $achievements;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \DateTime $created
|
* @var \DateTime $created
|
||||||
*
|
*
|
||||||
|
@ -67,6 +78,7 @@ class Game
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->hits = new ArrayCollection();
|
$this->hits = new ArrayCollection();
|
||||||
|
$this->achievements = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addHit(Hit $hit) {
|
public function addHit(Hit $hit) {
|
||||||
|
@ -241,10 +253,25 @@ class Game
|
||||||
if($diffExpression) {
|
if($diffExpression) {
|
||||||
/* @var $diffExpressionText string */
|
/* @var $diffExpressionText string */
|
||||||
$diffExpressionText = $betterHit->getExpressions()::$EXPRESSIONS_2ND_PERSON[$diffExpression];
|
$diffExpressionText = $betterHit->getExpressions()::$EXPRESSIONS_2ND_PERSON[$diffExpression];
|
||||||
$text .= " To show your empathy, you have to " . $diffExpressionText ." " . $diff . "% " . $diffText .".";
|
$text .= " To show more empathy, try to " . $diffExpressionText ." " . $diff . "% " . $diffText .".";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the achievements
|
||||||
|
*
|
||||||
|
* @return ArrayCollection[Achievements]
|
||||||
|
*/
|
||||||
|
public function getAchievements()
|
||||||
|
{
|
||||||
|
return $this->achievements;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addAchievement(Achievement $a)
|
||||||
|
{
|
||||||
|
$this->achievements->add($a);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue