Test and fixes every REST ressources already implemented.
[Project_proches_de_moi-server.git] / src / Entity / Localisation.php
index 69431b97640b426183700232cd9f7bbc4a5f677d..25ee27e7634e01b342df0d8319a73af27951995c 100644 (file)
@@ -2,10 +2,12 @@
 namespace App\Entity;
 
 use Doctrine\ORM\Mapping as ORM;
+use JMS\Serializer\Annotation as Serializer;
 
 /**
  * @ORM\Entity()
  * @ORM\Table(name="Localisation")
+ * @Serializer\ExclusionPolicy("all")
  */
 class Localisation
 {
@@ -17,22 +19,25 @@ class Localisation
     protected $id;
 
     /**
-     * @ORM\ManyToOne(targetEntity="App\Entity\Person", cascade={"all"})
+     * @ORM\ManyToOne(targetEntity="App\Entity\Person")
      */
     protected $person;
 
     /**
      * @ORM\Column(type="datetime")
+     * @Serializer\Expose
      */
     protected $timestamp;
 
     /**
      * @ORM\Column(type="float")
+     * @Serializer\Expose
      */
     protected $latitude;
 
     /**
      * @ORM\Column(type="float")
+     * @Serializer\Expose
      */
     protected $longitude;
 
@@ -67,6 +72,12 @@ class Localisation
         return $this;
     }
 
+    public function setPerson($person)
+    {
+        $this->person = $person;
+        return $this;
+    }
+
     public function setTimestamp($timestamp)
     {
         $this->timestamp = $timestamp;