Controller/WikiTagController.php
changeset 60 984ba20c150b
parent 59 ea562f37d7a5
child 61 1bc0ec8ed05b
equal deleted inserted replaced
59:ea562f37d7a5 60:984ba20c150b
   596     {
   596     {
   597         if($tag!=null && $label!=null){
   597         if($tag!=null && $label!=null){
   598             if($label!=$tag->getLabel()){
   598             if($label!=$tag->getLabel()){
   599                 // We get the Wikipedia informations for the sent label
   599                 // We get the Wikipedia informations for the sent label
   600                 $tag_label_normalized = WikiTagUtils::normalizeTag($label);
   600                 $tag_label_normalized = WikiTagUtils::normalizeTag($label);
   601                 try {
   601                 $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized);
   602                     $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized);
       
   603                 }
       
   604                 catch (\Exception $e){
       
   605                     throw new \Exception($e->getMessage());
       
   606                 }
       
   607                 $tag->setWikipediaInfo($wp_response);
   602                 $tag->setWikipediaInfo($wp_response);
   608                 // Save datas.
   603                 // Save datas.
   609                 $em = $this->getDoctrine()->getEntityManager();
   604                 $em = $this->getDoctrine()->getEntityManager();
   610                 $em->persist($tag);
   605                 $em->persist($tag);
   611                 $em->flush();
   606                 $em->flush();