/** * @userCache * * @param int $userId ユーザID * @param int $targetId フォロー中ユーザのID * * @return Logics_Result */ public function remove($userId, $targetId) { $result = new Logics_Result(); $aUser = new User($userId); $target = new User($targetId); if ($aUser->isSelected() && $target->isSelected()) { if (!Follower::isFollowed($userId, $targetId) && $target->isProtected()) { $request = new Request(); $request->setCondition("user_id", $userId); $request->setCondition("request_id", $targetId); $request->delete(); $result->removeType = "request"; } else { $follower = new Follower(); $follower->setCondition("user_id", $userId); $follower->setCondition("follow_id", $targetId); $follower->delete(); $result->removeType = "follow"; } } else { $result->failure(); } return $result; }