Loading module/Oscar/src/Oscar/Entity/ImmobilierLocal.php +3 −54 Original line number Diff line number Diff line Loading @@ -23,19 +23,19 @@ class ImmobilierLocal * @var string * @ORM\Column(type="text", nullable="true") */ private $nom; public $nom; /** * @var string * @ORM\Column(type="text", nullable="true") */ private $libelle; public $libelle; /** * @var string * @ORM\Column(type="text", nullable="true") */ private $idSourceDistante; public $idSourceDistante; /** * @return mixed Loading @@ -44,55 +44,4 @@ class ImmobilierLocal { return $this->id; } /** * @return string */ public function getNom(): string { return $this->nom; } /** * @param string $nom */ public function setNom(string $nom): self { $this->nom = $nom; return $this; } /** * @return string */ public function getLibelle(): string { return $this->libelle; } /** * @param string $libelle */ public function setLibelle(string $libelle): self { $this->libelle = $libelle; return $this; } /** * @return string */ public function getIdSourceDistante(): string { return $this->idSourceDistante; } /** * @param string $idSourceDistante */ public function setIdSourceDistante(string $idSourceDistante): self { $this->idSourceDistante = $idSourceDistante; return $this; } } module/Oscar/src/Oscar/Service/ImmobilierLocalService.php +22 −0 Original line number Diff line number Diff line Loading @@ -19,7 +19,29 @@ class ImmobilierLocalService implements UseEntityManager, UseLoggerService, UseO { $logs = array(); if (!array_key_exists('_embedded', $data)) { $logs[] = 'Clé _embedded non présente dans le JSON des données'; return $logs; } $embedded = $data['_embedded']; if (!array_key_exists('immobilier-local', $embedded)) { $logs[] = "Clé ['_embedded']['immobilier-local'] non présente dans le JSON des données"; return $logs; } $immobilierLocalArray = $embedded['immobilier-local']; if (!is_array($immobilierLocalArray)) { $logs[] = "La clé ['_embedded']['immobilier-local'] dans le JSON doit être un tableau de données"; return $logs; } foreach ($immobilierLocalArray as $i) { $e = new \Oscar\Entity\ImmobilierLocal(); $e->nom = $i['nom']; $e->libelle = $i['libelle']; $e->idSourceDistante = $i['id']; $this->getEntityManager()->persist($e); $this->getEntityManager()->flush(); } return $logs; } Loading Loading
module/Oscar/src/Oscar/Entity/ImmobilierLocal.php +3 −54 Original line number Diff line number Diff line Loading @@ -23,19 +23,19 @@ class ImmobilierLocal * @var string * @ORM\Column(type="text", nullable="true") */ private $nom; public $nom; /** * @var string * @ORM\Column(type="text", nullable="true") */ private $libelle; public $libelle; /** * @var string * @ORM\Column(type="text", nullable="true") */ private $idSourceDistante; public $idSourceDistante; /** * @return mixed Loading @@ -44,55 +44,4 @@ class ImmobilierLocal { return $this->id; } /** * @return string */ public function getNom(): string { return $this->nom; } /** * @param string $nom */ public function setNom(string $nom): self { $this->nom = $nom; return $this; } /** * @return string */ public function getLibelle(): string { return $this->libelle; } /** * @param string $libelle */ public function setLibelle(string $libelle): self { $this->libelle = $libelle; return $this; } /** * @return string */ public function getIdSourceDistante(): string { return $this->idSourceDistante; } /** * @param string $idSourceDistante */ public function setIdSourceDistante(string $idSourceDistante): self { $this->idSourceDistante = $idSourceDistante; return $this; } }
module/Oscar/src/Oscar/Service/ImmobilierLocalService.php +22 −0 Original line number Diff line number Diff line Loading @@ -19,7 +19,29 @@ class ImmobilierLocalService implements UseEntityManager, UseLoggerService, UseO { $logs = array(); if (!array_key_exists('_embedded', $data)) { $logs[] = 'Clé _embedded non présente dans le JSON des données'; return $logs; } $embedded = $data['_embedded']; if (!array_key_exists('immobilier-local', $embedded)) { $logs[] = "Clé ['_embedded']['immobilier-local'] non présente dans le JSON des données"; return $logs; } $immobilierLocalArray = $embedded['immobilier-local']; if (!is_array($immobilierLocalArray)) { $logs[] = "La clé ['_embedded']['immobilier-local'] dans le JSON doit être un tableau de données"; return $logs; } foreach ($immobilierLocalArray as $i) { $e = new \Oscar\Entity\ImmobilierLocal(); $e->nom = $i['nom']; $e->libelle = $i['libelle']; $e->idSourceDistante = $i['id']; $this->getEntityManager()->persist($e); $this->getEntityManager()->flush(); } return $logs; } Loading