/** * 반대 * * @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); }
/** * 반대 * * @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); }
/** * get show page url * 1. slug 가 있다면 slug 로 url return * 1. short id 가 있다면 short id 로 url return * 1. 기본 id 로 url return * * @param ItemEntity $item board item entity * @param array $params parameters * @return string */ public function getShow(ItemEntity $item, $params = []) { if ($item->getSlug() !== null) { return $this->getSlug($item->getSlug()->slug, $params); } $id = $item->id; if (($shortId = $item->getShortId()) !== null) { $id = $shortId->getId(); } $params['id'] = $id; return $this->get('show', $params); }
/** * 문서 복원 * * @param ItemEntity $item board item entity * @return int 삭제된 문서 수 */ public function restore(ItemEntity $item) { return $this->document->restore($item->getDocument()); }