/** * 반대 * * @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); }
/** * update read count * * @param DocumentEntity $doc document entity * @return void */ private function updateCount(DocumentEntity $doc) { $count = $this->count($doc->id); $doc->readCount = $count; $this->document->rawPut($doc); }