Test and fixes every REST ressources already implemented.
[Project_proches_de_moi-server.git] / src / Entity / Person.php
index 7897cfb4454c1b40dd18840f57d1bf942eeeb8e6..62cb46b3a446ccb2cf0648191b7107faeada4fa7 100644 (file)
@@ -3,17 +3,13 @@ namespace App\Entity;
 
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\ORM\Mapping as ORM;
-use JMS\Serializer\Annotation\ExclusionPolicy;
-use JMS\Serializer\Annotation\Expose;
+use JMS\Serializer\Annotation as Serializer;
 
 /**
  * @ORM\Entity()
  * @ORM\Table(name="Person", indexes={@ORM\Index(name="authentification_idx", columns={"email", "password"}),
  *                                    @ORM\Index(name="search_idx", columns={"firstname", "lastname", "email"})});
- * The following annotations tells the serializer to skip all properties which
- * have not marked with @Expose.
- *
- * @ExclusionPolicy("all")
+ * @Serializer\ExclusionPolicy("all")
  */
 class Person
 {
@@ -21,49 +17,48 @@ class Person
      * @ORM\Id
      * @ORM\Column(type="bigint")
      * @ORM\GeneratedValue(strategy="AUTO")
-     * @Expose
+     * @Serializer\Expose
      */
     protected $id;
 
     /**
      * @ORM\Column(type="string")
-     * @Expose
+     * @Serializer\Expose
      */
     protected $firstname;
 
     /**
      * @ORM\Column(type="string")
-     * @Expose
+     * @Serializer\Expose
      */
     protected $lastname;
 
     /**
      * @ORM\Column(type="string", unique=true)
-     * @Expose
+     * @Serializer\Expose
      */
     protected $email;
 
     /**
      * @ORM\Column(type="string")
-     * @Expose
      */
     protected $password;
 
     /**
      * @ORM\Column(type="boolean", options={"default":false})
-     * @Expose
+     * @Serializer\Expose
      */
     protected $online;
 
     /**
     * One person have many friends
-    * @ORM\OneToMany(targetEntity="App\Entity\Friendship", mappedBy="person", cascade={"all"})
+    * @ORM\OneToMany(targetEntity="App\Entity\Friendship", mappedBy="person")
     */
     protected $friends;
 
     /**
     * One person have many friends
-    * @ORM\OneToMany(targetEntity="App\Entity\Friendship", mappedBy="friend", cascade={"all"})
+    * @ORM\OneToMany(targetEntity="App\Entity\Friendship", mappedBy="friend")
     */
     protected $friends_with_me;