Fix user model nullable
This commit is contained in:
parent
2cedc5e0c3
commit
88d3323107
2 changed files with 323 additions and 63 deletions
|
@ -37,20 +37,6 @@ foreach($queries as $sql){ echo "$sql;\n"; }
|
|||
$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();
|
||||
// ADD EMOTIONS
|
||||
|
||||
$emotions = [];
|
||||
|
@ -72,6 +58,280 @@ try {
|
|||
echo "\nEmotions Probably already inserted...\n";
|
||||
}
|
||||
|
||||
|
||||
$lvl = new EmotionHero\Models\Level();
|
||||
$lvl->setId(5);
|
||||
$lvl->setName("Welcome to the seven");
|
||||
$i = 2;
|
||||
$lvl->createTarget($emotions['joy'], 100, $i++);
|
||||
$lvl->createTarget($emotions['joy'], 100, $i++);
|
||||
$lvl->createTarget($emotions['joy'], 100, $i++);
|
||||
$i++;
|
||||
$i++;
|
||||
$lvl->createTarget($emotions['sadness'], 100, $i++);
|
||||
$lvl->createTarget($emotions['sadness'], 100, $i++);
|
||||
$lvl->createTarget($emotions['sadness'], 100, $i++);
|
||||
$i++;
|
||||
$i++;
|
||||
$lvl->createTarget($emotions['anger'], 100, $i++);
|
||||
$lvl->createTarget($emotions['anger'], 100, $i++);
|
||||
$lvl->createTarget($emotions['anger'], 100, $i++);
|
||||
$i++;
|
||||
$i++;
|
||||
$lvl->createTarget($emotions['surprise'], 100, $i++);
|
||||
$lvl->createTarget($emotions['surprise'], 100, $i++);
|
||||
$lvl->createTarget($emotions['surprise'], 100, $i++);
|
||||
$i++;
|
||||
$i++;
|
||||
$lvl->createTarget($emotions['disgust'], 100, $i++);
|
||||
$lvl->createTarget($emotions['disgust'], 100, $i++);
|
||||
$lvl->createTarget($emotions['disgust'], 100, $i++);
|
||||
$i++;
|
||||
$i++;
|
||||
$lvl->createTarget($emotions['contempt'], 100, $i++);
|
||||
$lvl->createTarget($emotions['contempt'], 100, $i++);
|
||||
$lvl->createTarget($emotions['contempt'], 100, $i++);
|
||||
$i++;
|
||||
$i++;
|
||||
$lvl->createTarget($emotions['fear'], 100, $i++);
|
||||
$lvl->createTarget($emotions['fear'], 100, $i++);
|
||||
$lvl->createTarget($emotions['fear'], 100, $i++);
|
||||
$em->persist($lvl);
|
||||
|
||||
$lvl = new EmotionHero\Models\Level();
|
||||
$lvl->setId(6);
|
||||
$lvl->setName("\"Smile like you mean it\"");
|
||||
|
||||
$lvl = new EmotionHero\Models\Level();
|
||||
$lvl->setId(7);
|
||||
$lvl->setName("\"Let's talk business\"");
|
||||
|
||||
$lvl = new EmotionHero\Models\Level();
|
||||
$lvl->setId(8);
|
||||
$lvl->setName("Show me what you really feel");
|
||||
|
||||
$lvl = new EmotionHero\Models\Level();
|
||||
$lvl->setId(9);
|
||||
$lvl->setName("Please act normally");
|
||||
|
||||
$em->flush();
|
||||
die();
|
||||
// ////////////////// new levels:
|
||||
|
||||
// case LVL_SMILE:
|
||||
// int s = 2;
|
||||
// setTarget(Emotion.JOY, 100, s++);
|
||||
// setTarget(Emotion.JOY, 100, s++);
|
||||
// setTarget(Emotion.JOY, 50, s++);
|
||||
// setTarget(Emotion.JOY, 50, s++);
|
||||
// setTarget(Emotion.JOY, 30, s++);
|
||||
// setTarget(Emotion.JOY, 30, s++);
|
||||
// setTarget(Emotion.JOY, 50, s++);
|
||||
// setTarget(Emotion.JOY, 50, s++);
|
||||
// setTarget(Emotion.JOY, 100, s++);
|
||||
// setTarget(Emotion.JOY, 100, s++);
|
||||
|
||||
// s++;
|
||||
// s++;
|
||||
|
||||
// setTarget(Emotion.SURPRISE, 100, s++);
|
||||
// setTarget(Emotion.SURPRISE, 100, s++);
|
||||
// setTarget(Emotion.SURPRISE, 50, s++);
|
||||
// setTarget(Emotion.SURPRISE, 50, s++);
|
||||
// setTarget(Emotion.SURPRISE, 100, s++);
|
||||
// setTarget(Emotion.SURPRISE, 100, s++);
|
||||
|
||||
// s++;
|
||||
// s++;
|
||||
// s++;
|
||||
// setTarget(Emotion.JOY, 100, s++);
|
||||
// setTarget(Emotion.SURPRISE, 100, s);
|
||||
// setTarget(Emotion.JOY, 100, s++);
|
||||
// setTarget(Emotion.SURPRISE, 100, s);
|
||||
// setTarget(Emotion.JOY, 100, s++);
|
||||
// setTarget(Emotion.SURPRISE, 50, s);
|
||||
// setTarget(Emotion.SURPRISE, 30, s);
|
||||
|
||||
// s++;
|
||||
// s++;
|
||||
// setTarget(Emotion.JOY, 100, s++);
|
||||
// setTarget(Emotion.ANGER, 1, s);
|
||||
// setTarget(Emotion.CONTEMPT, 1, s);
|
||||
// setTarget(Emotion.DISGUST, 1, s);
|
||||
|
||||
// s++;
|
||||
// s++;
|
||||
// setTarget(Emotion.DISGUST, 1, s++);
|
||||
// setTarget(Emotion.ANGER, 1, s);
|
||||
// setTarget(Emotion.SURPRISE, 100, s);
|
||||
|
||||
// setMinimumScoreFromPercentage(40);
|
||||
// minimumAchievements = 2;
|
||||
// achievements.add(achievementCollection.get(5));
|
||||
// achievements.add(achievementCollection.get(6));
|
||||
// achievements.add(achievementCollection.get(7));
|
||||
// break;
|
||||
// case LVL_BUSINESS:
|
||||
// int b = 2;
|
||||
|
||||
// setTarget(Emotion.ANGER, 100, b++);
|
||||
// setTarget(Emotion.ANGER, 100, b++);
|
||||
// setTarget(Emotion.ANGER, 50, b++);
|
||||
// setTarget(Emotion.ANGER, 50, b++);
|
||||
// setTarget(Emotion.ANGER, 30, b++);
|
||||
// setTarget(Emotion.ANGER, 30, b++);
|
||||
// b++;
|
||||
// setTarget(Emotion.DISGUST, 100, b++);
|
||||
// setTarget(Emotion.DISGUST, 50, b++);
|
||||
// setTarget(Emotion.DISGUST, 50, b++);
|
||||
// setTarget(Emotion.DISGUST, 30, b++);
|
||||
// b++;
|
||||
// setTarget(Emotion.CONTEMPT, 100, b++);
|
||||
// setTarget(Emotion.CONTEMPT, 50, b++);
|
||||
// setTarget(Emotion.CONTEMPT, 50, b++);
|
||||
// setTarget(Emotion.CONTEMPT, 30, b++);
|
||||
// b++;
|
||||
// setTarget(Emotion.SURPRISE, 100, b++);
|
||||
|
||||
// setTarget(Emotion.SURPRISE, 100, b++);
|
||||
// setTarget(Emotion.SADNESS, 50, b);
|
||||
|
||||
// setTarget(Emotion.JOY, 50, b++);
|
||||
// setTarget(Emotion.DISGUST, 50, b++);
|
||||
// setTarget(Emotion.CONTEMPT, 30, b++);
|
||||
// setTarget(Emotion.CONTEMPT, 100, b++);
|
||||
// setTarget(Emotion.JOY, 100, b++);
|
||||
// setTarget(Emotion.SURPRISE, 100, b++);
|
||||
|
||||
// b++;
|
||||
// setTarget(Emotion.SADNESS, 100, b++);
|
||||
// setTarget(Emotion.ANGER, 10, b++);
|
||||
// setTarget(Emotion.SADNESS, 100, b++);
|
||||
// setTarget(Emotion.ANGER, 10, b++);
|
||||
// setTarget(Emotion.SADNESS, 100, b++);
|
||||
// setTarget(Emotion.ANGER, 10, b++);
|
||||
|
||||
|
||||
// setMinimumScoreFromPercentage(40);
|
||||
// minimumAchievements = 2;
|
||||
// achievements.add(achievementCollection.get(8));
|
||||
// achievements.add(achievementCollection.get(9));
|
||||
// achievements.add(achievementCollection.get(10));
|
||||
// break;
|
||||
// case LVL_REALLY:
|
||||
// int r = 2;
|
||||
// setTarget(Emotion.FEAR, 100, r++);
|
||||
// setTarget(Emotion.FEAR, 50, r++);
|
||||
// setTarget(Emotion.FEAR, 30, r++);
|
||||
|
||||
// r++;
|
||||
// setTarget(Emotion.SADNESS, 100, r++);
|
||||
// setTarget(Emotion.SADNESS, 50, r++);
|
||||
// setTarget(Emotion.SADNESS, 100, r++);
|
||||
|
||||
// r++;
|
||||
// setTarget(Emotion.DISGUST, 100, r++);
|
||||
// setTarget(Emotion.DISGUST, 100, r++);
|
||||
// setTarget(Emotion.DISGUST, 50, r++);
|
||||
|
||||
// r++;
|
||||
// setTarget(Emotion.DISGUST, 100, r++);
|
||||
// setTarget(Emotion.CONTEMPT, 30, r);
|
||||
// setTarget(Emotion.DISGUST, 50, r++);
|
||||
// setTarget(Emotion.CONTEMPT, 50, r);
|
||||
// setTarget(Emotion.DISGUST, 30, r++);
|
||||
// setTarget(Emotion.CONTEMPT, 100, r);
|
||||
|
||||
// r++;
|
||||
// r++;
|
||||
// setTarget(Emotion.SADNESS, 100, r++);
|
||||
// setTarget(Emotion.JOY, 50, r++);
|
||||
// setTarget(Emotion.SADNESS, 100, r++);
|
||||
// setTarget(Emotion.JOY, 50, r++);
|
||||
// setTarget(Emotion.SADNESS, 50, r++);
|
||||
// setTarget(Emotion.JOY, 100, r++);
|
||||
// setTarget(Emotion.SADNESS, 50, r++);
|
||||
// setTarget(Emotion.JOY, 100, r);
|
||||
// setTarget(Emotion.SADNESS, 100, r++);
|
||||
// setTarget(Emotion.JOY, 50, r);
|
||||
|
||||
|
||||
// setMinimumScoreFromPercentage(40);
|
||||
// minimumAchievements = 2;
|
||||
// achievements.add(achievementCollection.get(8));
|
||||
// achievements.add(achievementCollection.get(9));
|
||||
// achievements.add(achievementCollection.get(10));
|
||||
// achievements.add(achievementCollection.get(11));
|
||||
|
||||
// break;
|
||||
// case LVL_ACTNORMAL:
|
||||
// float a = 2;
|
||||
// setTarget(Emotion.ANGER, 100, a++);
|
||||
// setTarget(Emotion.DISGUST, 100, a++);
|
||||
// setTarget(Emotion.FEAR, 100, a++);
|
||||
// setTarget(Emotion.JOY, 100, a++);
|
||||
// setTarget(Emotion.SADNESS, 100, a++);
|
||||
// setTarget(Emotion.SURPRISE, 100, a++);
|
||||
|
||||
// a++;
|
||||
// setTarget(Emotion.ANGER, 30, a++);
|
||||
// setTarget(Emotion.DISGUST, 30, a+=0.5);
|
||||
// setTarget(Emotion.FEAR, 30, a+=0.5);
|
||||
// setTarget(Emotion.JOY, 30, a+=0.5);
|
||||
// setTarget(Emotion.SADNESS, 30, a+=0.5);
|
||||
// setTarget(Emotion.SURPRISE, 30, a+=0.5);
|
||||
|
||||
// a++;
|
||||
// setTarget(Emotion.ANGER, 30, a++);
|
||||
// setTarget(Emotion.DISGUST, 30, a);
|
||||
// setTarget(Emotion.ANGER, 30, a++);
|
||||
// setTarget(Emotion.DISGUST, 30, a);
|
||||
|
||||
// setTarget(Emotion.FEAR, 30, a++);
|
||||
// setTarget(Emotion.JOY, 30, a);
|
||||
// setTarget(Emotion.FEAR, 30, a++);
|
||||
// setTarget(Emotion.JOY, 30, a);
|
||||
|
||||
// setTarget(Emotion.SADNESS, 30, a++);
|
||||
// setTarget(Emotion.SURPRISE, 30, a);
|
||||
// setTarget(Emotion.SADNESS, 30, a++);
|
||||
// setTarget(Emotion.SURPRISE, 30, a);
|
||||
|
||||
// a++;
|
||||
// a++;
|
||||
// setTarget(Emotion.DISGUST, 20, a++);
|
||||
// setTarget(Emotion.CONTEMPT, 20, a);
|
||||
// setTarget(Emotion.SURPRISE, 20, a);
|
||||
|
||||
// setTarget(Emotion.DISGUST, 10, a++);
|
||||
// setTarget(Emotion.CONTEMPT, 10, a);
|
||||
// setTarget(Emotion.SURPRISE, 10, a);
|
||||
|
||||
// setTarget(Emotion.DISGUST, 5, a++);
|
||||
// setTarget(Emotion.CONTEMPT, 5, a);
|
||||
// setTarget(Emotion.SURPRISE, 5, a);
|
||||
|
||||
// // Kuleshov's target:
|
||||
// kuleshovTargetIds = new int[3];
|
||||
// kuleshovTargetIds[0] = setTarget(Emotion.DISGUST, 1, a++);
|
||||
// kuleshovTargetIds[1] = setTarget(Emotion.CONTEMPT, 1, a);
|
||||
// kuleshovTargetIds[2] = setTarget(Emotion.SURPRISE, 1, a);
|
||||
// // END OF KULESHOV
|
||||
|
||||
// setTarget(Emotion.DISGUST, 1, a++);
|
||||
// setTarget(Emotion.CONTEMPT, 1, a);
|
||||
// setTarget(Emotion.SURPRISE, 1, a);
|
||||
|
||||
|
||||
// setTarget(Emotion.ANGER, 1, a++);
|
||||
// setTarget(Emotion.CONTEMPT, 1, a);
|
||||
// setTarget(Emotion.DISGUST, 1, a);
|
||||
// setTarget(Emotion.FEAR, 1, a);
|
||||
// setTarget(Emotion.JOY, 1, a);
|
||||
// setTarget(Emotion.SADNESS, 1, a);
|
||||
// setTarget(Emotion.SURPRISE, 1, a);
|
||||
die();
|
||||
|
||||
// TEST USER
|
||||
|
||||
if(empty($em->getRepository(EmotionHero\Models\User::class)->findOneBy([]))) {
|
||||
|
@ -81,57 +341,57 @@ if(empty($em->getRepository(EmotionHero\Models\User::class)->findOneBy([]))) {
|
|||
$em->flush();
|
||||
}
|
||||
|
||||
$lvl = new EmotionHero\Models\Level();
|
||||
$lvl->setId(1);
|
||||
$lvl->setName("I am sooo ANGRY");
|
||||
$lvl->createTarget($emotions['anger'], 100, 1);
|
||||
$lvl->createTarget($emotions['anger'], 100, 2);
|
||||
$lvl->createTarget($emotions['anger'], 10, 3);
|
||||
$lvl->createTarget($emotions['anger'], 20, 4);
|
||||
$lvl->createTarget($emotions['anger'], 40, 5);
|
||||
$lvl->createTarget($emotions['anger'], 70, 6);
|
||||
$lvl->createTarget($emotions['anger'], 100, 7);
|
||||
$em->persist($lvl);
|
||||
// $lvl = new EmotionHero\Models\Level();
|
||||
// $lvl->setId(1);
|
||||
// $lvl->setName("I am sooo ANGRY");
|
||||
// $lvl->createTarget($emotions['anger'], 100, 1);
|
||||
// $lvl->createTarget($emotions['anger'], 100, 2);
|
||||
// $lvl->createTarget($emotions['anger'], 10, 3);
|
||||
// $lvl->createTarget($emotions['anger'], 20, 4);
|
||||
// $lvl->createTarget($emotions['anger'], 40, 5);
|
||||
// $lvl->createTarget($emotions['anger'], 70, 6);
|
||||
// $lvl->createTarget($emotions['anger'], 100, 7);
|
||||
// $em->persist($lvl);
|
||||
|
||||
|
||||
$lvl = new EmotionHero\Models\Level();
|
||||
$lvl->setId(2);
|
||||
$lvl->setName("Let's be joyfull!");
|
||||
$lvl->createTarget($emotions['joy'], 100, 1);
|
||||
$lvl->createTarget($emotions['joy'], 100, 2);
|
||||
$lvl->createTarget($emotions['joy'], 100, 4);
|
||||
$lvl->createTarget($emotions['contempt'], 20, 4);
|
||||
$lvl->createTarget($emotions['anger'], 100, 5);
|
||||
$lvl->createTarget($emotions['joy'], 100, 7);
|
||||
$lvl->createTarget($emotions['anger'], 100, 9);
|
||||
$lvl->createTarget($emotions['joy'], 100, 11);
|
||||
$lvl->createTarget($emotions['joy'], 70, 12);
|
||||
$lvl->createTarget($emotions['joy'], 60, 13);
|
||||
$lvl->createTarget($emotions['joy'], 30, 14);
|
||||
$lvl->createTarget($emotions['joy'], 10, 14.5);
|
||||
$lvl->createTarget($emotions['anger'], 100, 16);
|
||||
$lvl->createTarget($emotions['joy'], 100, 17);
|
||||
$lvl->createTarget($emotions['joy'], 100, 18);
|
||||
$lvl->createTarget($emotions['joy'], 100, 19);
|
||||
$lvl->createTarget($emotions['joy'], 100, 20);
|
||||
$em->persist($lvl);
|
||||
// $lvl = new EmotionHero\Models\Level();
|
||||
// $lvl->setId(2);
|
||||
// $lvl->setName("Let's be joyfull!");
|
||||
// $lvl->createTarget($emotions['joy'], 100, 1);
|
||||
// $lvl->createTarget($emotions['joy'], 100, 2);
|
||||
// $lvl->createTarget($emotions['joy'], 100, 4);
|
||||
// $lvl->createTarget($emotions['contempt'], 20, 4);
|
||||
// $lvl->createTarget($emotions['anger'], 100, 5);
|
||||
// $lvl->createTarget($emotions['joy'], 100, 7);
|
||||
// $lvl->createTarget($emotions['anger'], 100, 9);
|
||||
// $lvl->createTarget($emotions['joy'], 100, 11);
|
||||
// $lvl->createTarget($emotions['joy'], 70, 12);
|
||||
// $lvl->createTarget($emotions['joy'], 60, 13);
|
||||
// $lvl->createTarget($emotions['joy'], 30, 14);
|
||||
// $lvl->createTarget($emotions['joy'], 10, 14.5);
|
||||
// $lvl->createTarget($emotions['anger'], 100, 16);
|
||||
// $lvl->createTarget($emotions['joy'], 100, 17);
|
||||
// $lvl->createTarget($emotions['joy'], 100, 18);
|
||||
// $lvl->createTarget($emotions['joy'], 100, 19);
|
||||
// $lvl->createTarget($emotions['joy'], 100, 20);
|
||||
// $em->persist($lvl);
|
||||
|
||||
$lvl = new EmotionHero\Models\Level();
|
||||
$lvl->setId(3);
|
||||
$lvl->setName("What a surprise");
|
||||
$lvl->createTarget($emotions['surprise'], 20, 1);
|
||||
$lvl->createTarget($emotions['surprise'], 50, 2);
|
||||
$lvl->createTarget($emotions['surprise'], 80, 3);
|
||||
$lvl->createTarget($emotions['surprise'], 100, 4);
|
||||
$em->persist($lvl);
|
||||
// $lvl = new EmotionHero\Models\Level();
|
||||
// $lvl->setId(3);
|
||||
// $lvl->setName("What a surprise");
|
||||
// $lvl->createTarget($emotions['surprise'], 20, 1);
|
||||
// $lvl->createTarget($emotions['surprise'], 50, 2);
|
||||
// $lvl->createTarget($emotions['surprise'], 80, 3);
|
||||
// $lvl->createTarget($emotions['surprise'], 100, 4);
|
||||
// $em->persist($lvl);
|
||||
|
||||
$lvl = new EmotionHero\Models\Level();
|
||||
$lvl->setId(4);
|
||||
$lvl->setName("Please, don't cry...");
|
||||
$lvl->createTarget($emotions['sadness'], 20, 1);
|
||||
$lvl->createTarget($emotions['sadness'], 50, 2);
|
||||
$lvl->createTarget($emotions['sadness'], 80, 3);
|
||||
$lvl->createTarget($emotions['sadness'], 100, 4);
|
||||
$em->persist($lvl);
|
||||
// $lvl = new EmotionHero\Models\Level();
|
||||
// $lvl->setId(4);
|
||||
// $lvl->setName("Please, don't cry...");
|
||||
// $lvl->createTarget($emotions['sadness'], 20, 1);
|
||||
// $lvl->createTarget($emotions['sadness'], 50, 2);
|
||||
// $lvl->createTarget($emotions['sadness'], 80, 3);
|
||||
// $lvl->createTarget($emotions['sadness'], 100, 4);
|
||||
// $em->persist($lvl);
|
||||
|
||||
$em->flush();
|
||||
|
|
|
@ -35,7 +35,7 @@ class User implements UserInterface
|
|||
private $games;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float")
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
* @JMS\Exclude
|
||||
* @var float
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue