public function getUserId() { if ($this->user instanceof \Newscoop\Entity\User) { return $this->user->getId(); } return null; }