Commit c63e0181 authored by Sebastian Castro's avatar Sebastian Castro

Fixs import external source

parent 4879fe06
......@@ -91,19 +91,6 @@ class ElementImportService
if ($onlyGetData) return $data;
$elementImportedCount = $this->import($data, $externalSource, true, true);
$this->em->persist($externalSource);
$qb = $this->em->createQueryBuilder('BiopenGeoDirectoryBundle:Element');
$qb->remove()
->field('source')->references($externalSource)
->field('status')->notEqual(ElementStatus::DynamicImportTemp)
->getQuery()->execute();
$qb->updateMany()
->field('status')->set(ElementStatus::DynamicImport)
->field('source')->references($externalSource)
->field('status')->equals(ElementStatus::DynamicImportTemp)
->getQuery()->execute();
return $elementImportedCount;
}
......@@ -155,6 +142,23 @@ class ElementImportService
$this->em->flush();
$this->em->clear();
if ($source->isExternalsource())
{
$this->em->persist($source);
$qb = $this->em->createQueryBuilder('BiopenGeoDirectoryBundle:Element');
$qb->remove()
->field('source')->references($source)
->field('status')->notEqual(ElementStatus::DynamicImportTemp)
->getQuery()->execute();
$qb->updateMany()
->field('status')->set(ElementStatus::DynamicImport)
->field('source')->references($source)
->field('status')->equals(ElementStatus::DynamicImportTemp)
->getQuery()->execute();
}
return $size;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment