Revert previous commit.
[Project_proches_de_moi-server.git] / src / Entity / Person.php
index 701b9e63cc6a550591be4a919a690e2b3193eb2a..91ffc15938e668db97b2eddcdc2cacfa40252e34 100644 (file)
@@ -3,11 +3,17 @@ namespace App\Entity;
 
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\ORM\Mapping as ORM;
+use JMS\Serializer\Annotation\ExclusionPolicy;
+use JMS\Serializer\Annotation\Expose;
 
 /**
  * @ORM\Entity()
  * @ORM\Table(name="Person", indexes={@ORM\Index(name="authentification_idx", columns={"email", "password"}),
- *                                    @ORM\Index(name="search_idx", columns={"firstname", "lastname"})});
+ *                                    @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")
  */
 class Person
 {
@@ -154,7 +160,7 @@ class Person
         $this->friends_with_me->add($friendship);
     }
 
-    public function addFriend(User $friend)
+    public function addFriend(Person $friend)
     {
         $fs = new Friendship();
         $fs->setPerson($this);