adapt code to be compatible with dinosaur php 5.3 V00.16
authorcavaliet
Fri, 04 Jul 2014 16:58:31 +0200
changeset 119 a1cf7fac5c2d
parent 118 c3f9a6086f52
child 120 a87d5900e6d6
adapt code to be compatible with dinosaur php 5.3
app/DoctrineMigrations/Version20140129151724.php
--- a/app/DoctrineMigrations/Version20140129151724.php	Fri Jul 04 16:57:59 2014 +0200
+++ b/app/DoctrineMigrations/Version20140129151724.php	Fri Jul 04 16:58:31 2014 +0200
@@ -42,29 +42,29 @@
         $evm->removeEventListener(array('onFlush', 'preRemove', 'postPersist', 'postUpdate',  'postRemove'), $listenerInst);
         
         // First step : we populate the dbpedia uris thanks to the dbpedia-owl:wikiPageID
-//         echo "\nFIRST STEP";
-//         $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE t.wikipediaPageId IS NOT NULL ORDER BY t.label ASC');//->setMaxResults(240)->setFirstResult(500);
-//         $tags = $query->getResult();
-//         $i = 1;
-//         $nb_set = 0;
-//         echo "\n".count($tags)." tags to search.";
-//         foreach($tags as $tag){
-//         	$l = $tag->getLabel();
-//         	$uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaPageId(), array(), false, "pageid");
-//         	$tag->setDbpediaUri($uri);
-//         	$em->persist($tag);
-// 	        if($uri!=NULL && $uri!=""){
-// 	            $nb_set++;
-// 	        }
-//         	if( $i % 50 == 0 ){
-//         		$em->flush();
-//         		echo "\n    FLUSH";
-//         	}
-//         	$i++;
-//         	echo "\n$i : $l \t\t: $uri";
-//         }
-//         $em->flush();
-//         echo "\nFIRST STEP : $nb_set uris found";
+        echo "\nFIRST STEP";
+        $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE t.wikipediaPageId IS NOT NULL ORDER BY t.label ASC');//->setMaxResults(240)->setFirstResult(500);
+        $tags = $query->getResult();
+        $i = 1;
+        $nb_set = 0;
+        echo "\n".count($tags)." tags to search.";
+        foreach($tags as $tag){
+        	$l = $tag->getLabel();
+        	$uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaPageId(), array(), false, "pageid");
+        	$tag->setDbpediaUri($uri);
+        	$em->persist($tag);
+	        if($uri!=NULL && $uri!=""){
+	            $nb_set++;
+	        }
+        	if( $i % 50 == 0 ){
+        		$em->flush();
+        		echo "\n    FLUSH";
+        	}
+        	$i++;
+        	echo "\n$i : $l \t\t: $uri";
+        }
+        $em->flush();
+        echo "\nFIRST STEP : $nb_set uris found";
         
         
         // Second step : we populate the dbpedia uris not found thanks to the foaf:isPrimaryTopicOf