/** * @param Thread $thread * @param User $user * @return bool */ public function remove(Thread $thread, User $user) { $owner = $thread->getUser(); if (!$owner || $owner->getId() != $user->getId()) { return false; } $this->threadRepository->remove($thread); $this->entityManager->flush(); return true; }