Example #1
0
 /**
  * scans the input xml data and finds the "fachbereich" tags and writes them into db
  * 
  * @param type $content
  */
 private function processFaculties($content, $utilityService)
 {
     $insertedIds = array();
     foreach ($content as $element) {
         $dataSrc = array();
         foreach ($element->childNodes as $node) {
             if ($node->nodeName != '#text') {
                 $data = $this->em->getRepository('DNTMBundle:Faculty')->findOneBy(array('id' => $node->getAttribute('id')));
                 if ($data == null) {
                     $data = new Faculty();
                     $data->setId($node->getAttribute('id'));
                 }
                 $data->setName($node->getAttribute('bezeichnung'));
                 if ($node->nodeName == 'fachgruppen') {
                     foreach ($node->childNodes as $childNode) {
                         if ($childNode->nodeName != '#text') {
                         }
                     }
                 }
                 if (!in_array($node->getAttribute('id'), $insertedIds)) {
                     $insertedIds[] = $node->getAttribute('id');
                     $this->em->merge($data);
                 }
             }
         }
     }
     $this->em->flush();
 }