/** * @param int|User $user * @return $this */ public function setUserId($user = 0) { if ($user instanceof User) { $this->userId = $user->getId(); } else { $this->userId = (int) $user; } return $this; }
/** * @param int|User $author * @return $this */ public function setAuthorId($author = 0) { if ($author instanceof User) { $this->authorId = $author->getId(); } else { $this->authorId = (int) $author; } return $this; }