userMessageBuilder = $this->loadService(UserMessageBuilder::class); } public function createUserMessage(User $user, string $message, User $createdBy): UserMessage { $userMessage = $this->userMessageBuilder->instanciateUserMessage($user, $createdBy); $userMessage->setMessage($message); $userMessage->save(); return $userMessage; } public function deleteUserMessage(UserMessage $userMessage): bool { return $userMessage->delete(); } public function readUserMessage(UserMessage $userMessage): bool { $userMessage->setReadAt(new \DateTime()); return $userMessage->save(); } }