2016-09-01 10:15:17 +00:00
|
|
|
<?php
|
|
|
|
chdir(__DIR__);
|
|
|
|
|
2016-09-01 15:35:43 +00:00
|
|
|
// define('APPLICATION_ENV', 'development');
|
2016-09-01 15:33:00 +00:00
|
|
|
|
2016-09-01 10:15:17 +00:00
|
|
|
require_once __DIR__ . "/../bootstrap.php";
|
|
|
|
|
2016-09-17 21:32:42 +00:00
|
|
|
error_reporting(E_ALL);
|
2016-09-17 21:35:26 +00:00
|
|
|
ini_set('display_errors',1);
|
2016-09-01 10:15:17 +00:00
|
|
|
// Show table creation statements
|
|
|
|
// And (re)generate Proxies
|
|
|
|
|
2016-09-01 10:25:51 +00:00
|
|
|
$em = EmotionHero\Application::getInstance()->getEm();
|
2016-09-01 10:15:17 +00:00
|
|
|
|
|
|
|
var_dump($em->getConnection()->getDatabasePlatform()->getName());
|
|
|
|
// $serializer = JMS\Serializer\SerializerBuilder::create()->build();
|
|
|
|
|
|
|
|
$metadatas = $em->getMetadataFactory()->getAllMetadata();
|
|
|
|
// $metadatas = MetadataFilter::filter($metadatas, $input->getOption('filter'));
|
|
|
|
$destPath = $em->getConfiguration()->getProxyDir();
|
|
|
|
$em->getProxyFactory()->generateProxyClasses($metadatas, $destPath);
|
|
|
|
|
|
|
|
|
|
|
|
$tool = new Doctrine\ORM\Tools\SchemaTool($em);
|
|
|
|
|
|
|
|
$classes = $metadatas;
|
|
|
|
|
|
|
|
|
|
|
|
// $classes = array(
|
|
|
|
// $em->getClassMetadata('EmotionHero\Models\Emotion'),
|
|
|
|
// );
|
|
|
|
|
|
|
|
// $tool->getCreateDatabaseSQL();
|
|
|
|
$queries = $tool->getCreateSchemaSQL($classes);
|
|
|
|
// $queries = $tool->getUpdateSchemaSql($classes);
|
|
|
|
foreach($queries as $sql){ echo "$sql;\n"; }
|
|
|
|
// updateSchema
|
|
|
|
$tool->updateSchema($classes);
|
|
|
|
|
2016-09-04 11:41:59 +00:00
|
|
|
|
2016-09-01 15:33:00 +00:00
|
|
|
// ADD EMOTIONS
|
|
|
|
|
|
|
|
$emotions = [];
|
|
|
|
try {
|
|
|
|
$emos = ['anger','contempt','disgust', 'fear', 'joy','sadness','surprise'];
|
|
|
|
foreach($emos as $emo) {
|
|
|
|
$emotion = $em->getRepository(EmotionHero\Models\Emotion::class)->findOneBy(['name' => $emo]);
|
|
|
|
if(empty($emotion))
|
|
|
|
{
|
|
|
|
$emotion = new EmotionHero\Models\Emotion();
|
|
|
|
$emotion->setName($emo);
|
|
|
|
$em->persist($emotion);
|
|
|
|
}
|
|
|
|
$emotions[$emo] = $emotion;
|
|
|
|
|
|
|
|
}
|
|
|
|
$em->flush();
|
|
|
|
} catch (Exception $e) {
|
|
|
|
echo "\nEmotions Probably already inserted...\n";
|
2016-09-01 10:15:17 +00:00
|
|
|
}
|
|
|
|
|
2016-09-17 19:08:09 +00:00
|
|
|
|
|
|
|
$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();
|
|
|
|
|
2016-09-01 15:33:00 +00:00
|
|
|
// TEST USER
|
2016-09-01 10:15:17 +00:00
|
|
|
|
2016-09-01 15:33:00 +00:00
|
|
|
if(empty($em->getRepository(EmotionHero\Models\User::class)->findOneBy([]))) {
|
|
|
|
$user = new EmotionHero\Models\User();
|
|
|
|
$em->persist($user);
|
|
|
|
|
|
|
|
$em->flush();
|
|
|
|
}
|
2016-09-01 10:15:17 +00:00
|
|
|
|
2016-09-17 19:08:09 +00:00
|
|
|
// $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);
|
2016-09-01 15:33:00 +00:00
|
|
|
|
|
|
|
|
2016-09-17 19:08:09 +00:00
|
|
|
// $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);
|
2016-09-01 15:33:00 +00:00
|
|
|
|
2016-09-17 19:08:09 +00:00
|
|
|
// $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);
|
2016-09-01 15:33:00 +00:00
|
|
|
|
2016-09-17 19:08:09 +00:00
|
|
|
// $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);
|
2016-09-01 15:33:00 +00:00
|
|
|
|
|
|
|
$em->flush();
|