mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-09 17:02:46 +02:00
linking demandes
This commit is contained in:
parent
0aa050b38b
commit
7f79ec3a9f
6 changed files with 190 additions and 10 deletions
|
@ -151,6 +151,20 @@ class PublicController extends AbstractController
|
|||
$demande->setOsmId((int)$data['osmId']);
|
||||
}
|
||||
|
||||
// Check if a Place exists with the same OSM ID and type
|
||||
if ($demande->getOsmId() && $demande->getOsmObjectType()) {
|
||||
$existingPlace = $this->entityManager->getRepository(Place::class)->findOneBy([
|
||||
'osm_kind' => $demande->getOsmObjectType(),
|
||||
'osmId' => $demande->getOsmId()
|
||||
]);
|
||||
|
||||
if ($existingPlace) {
|
||||
// Link the Place UUID to the Demande
|
||||
$demande->setPlaceUuid($existingPlace->getUuidForUrl());
|
||||
$demande->setPlace($existingPlace);
|
||||
}
|
||||
}
|
||||
|
||||
$this->entityManager->persist($demande);
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue