private function setAutor($autor)
 {
     $autor = trim(str_replace(["\n", "\r", "\t"], "", trim($autor)), " ");
     $autorObj = (object) $this->doctrine->em->getRepository('Scrapy\\models\\Autores')->findOneBy(['autor' => $autor]);
     if (!$autorObj->id) {
         $autorObj = new Autor();
         $autorObj->autor = $autor;
         $autorObj->slug = Helper::slugify($autor);
         $this->doctrine->em->persist($autorObj);
         $this->doctrine->em->flush();
     }
     return $autorObj;
 }
 private function getItens()
 {
     libxml_use_internal_errors(true);
     $doc = new \DOMDocument();
     $doc->loadHTML($this->bodyContents);
     $xpath = new \DOMXpath($doc);
     $trs = $xpath->query('//*[@id="res"]/tbody/tr');
     if (!is_null($trs)) {
         foreach ($trs as $tr) {
             $td = $tr->getElementsByTagName('td');
             // Get item ID
             // The ID is in the URL (../pesquisa/DetalheObraForm.do?select_action=&co_obra=28320)
             $link = $td->item(2)->getElementsByTagName('a')->item(0)->getAttribute('href');
             $id = Helper::extractUrl($link, 'co_obra');
             echo $id;
             //exec("php5 -f index.php route.item item." . $id . " > log");
             exit;
         }
     }
 }