public function addPendingFriendRequest($name, $host, $autoadd = false) { $ip = $_SERVER['REMOTE_ADDR']; $pending = new PendingFriend(); $pending->setName($name); $pending->setHost($host); $pending->setIp($ip); $this->om->persist($pending); $this->om->flush(); if ($autoadd) { $client = $this->acceptFriendAction($pending, true); $this->hideClient($client); } }