friends = new ArrayCollection(); $this->friends_with_me = new ArrayCollection(); } public function getId() { return $this->id; } public function getFirstName() { return $this->firstname; } public function getLastName() { return $this->lastname; } public function getEmail() { return $this->email; } public function getPassword() { return $this->password; } public function getOnline() { return $this->online; } public function getFriends() { return $this->friends; } public function getFriendsWithMe() { return $this->friends_with_me; } public function setId($id) { $this->id = $id; return $this; } public function setFirstName($firstname) { $this->firstname = $firstname; return $this; } public function setLastName($lastname) { $this->lastname = $lastname; return $this; } public function setEmail($email) { $this->email = $email; return $this; } public function setPassword($password) { $this->password = $password; return $this; } public function setOnline($online) { $this->online = $online; return $this; } public function addFriendship(Friendship $friendship) { $this->friends->add($friendship); $friendship->friend->addFriendshipWithMe($friendship); } public function addFriendshipWithMe(Friendship $friendship) { $this->friends_with_me->add($friendship); } public function addFriend(Person $friend) { $fs = new Friendship(); $fs->setPerson($this); $fs->setFriend($friend); // set defaults validation to true for now $fs->setIsValid(true); $this->addFriendship($fs); } }