/** * 반대 * * @param ItemEntity $item board item entity * @param MemberEntityInterface $author user instance * @return void */ public function remove(ItemEntity $item, MemberEntityInterface $author) { $doc = $item->getDocument(); $this->init(); $this->counter->remove($doc->id, $author, $option); $this->updateCount($doc); }
/** * 반대 * * @param ItemEntity $item board item entity * @param MemberEntityInterface $author user instance * @param string $option 'assent' or 'dissent' * @return void */ public function remove(ItemEntity $item, MemberEntityInterface $author, $option) { $doc = $item->getDocument(); $this->counter->init(self::COUNTER_NAME, $option); $this->counter->remove($doc->id, $author, $option); $count = $this->count($doc->id); if ($option == 'assent') { $doc->assentCount = $count['assent']; } elseif ($option == 'dissent') { $doc->dissentCount = $count['dissent']; } $this->document->rawPut($doc); }
/** * test get config handler * * @return void */ public function testGetConfigHandler() { $repo = $this->repo; $session = $this->session; $configHandler = $this->configHandler; $member = $this->member; $auth = $this->auth; $request = $this->request; $counter = new Counter($repo, $session, $configHandler, $member, $auth, $request); $configHandler = $counter->getConfigHandler(); $this->assertInstanceOf('Xpressengine\\Counter\\ConfigHandler', $configHandler); }
/** * has vote * * @param Board $board board model * @param UserInterface $user user * @param string $option 'assent' or 'dissent' * @return bool */ public function hasVote(Board $board, $user, $option) { return $this->voteCounter->has($board->id, $user, $option); }