diff -r 22752b3d9c35 -r 48af4fad8a44 app/DoctrineMigrations/Version20140129151724.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/DoctrineMigrations/Version20140129151724.php Thu Jan 30 17:52:14 2014 +0100 @@ -0,0 +1,49 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); + + // First we get all tags. + $em = $GLOBALS["kernel"]->getContainer()->get( 'doctrine.orm.entity_manager' ); + $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t ORDER BY t.label ASC');//->setMaxResults(40)->setFirstResult(5000); + $tags = $query->getResult(); + + $i = 1; + foreach($tags as $tag){ + $l = $tag->getLabel(); + $uri = WikiTagUtils::getDbpediaUri($tag->getLabel(), [], false); + $tag->setDbpediaUri($uri); + $em->persist($tag); + if( $i % 50 == 0 ){ + $em->flush(); + echo "\n FLUSH"; + } + $i++; + echo "\n$i : $l \t\t: $uri"; + } + $em->flush(); + } + + public function down(Schema $schema) + { + // this down() migration is autogenerated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); + } +}