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); $emotions = ['anger','contempt','disgust', 'fear', 'joy','sadness','surprise']; foreach($emotions as $emo) { $emotion = new EmotionHero\Models\Emotion(); $emotion->setName($emo); $em->persist($emotion); } $user = new EmotionHero\Models\User(); $em->persist($user); $em->flush(); var_dump($user->getId());