. */ namespace SP\Modules\Web\Controllers\AccountFavorite; use Exception; use JsonException; use SP\Core\Events\Event; use SP\Domain\Http\Dtos\JsonMessage; use SP\Modules\Web\Controllers\Traits\JsonTrait; /** * Class MarkController * * @package SP\Modules\Web\Controllers */ final class UnmarkController extends AccountFavoriteBase { use JsonTrait; /** * @param int $accountId * * @return bool * @throws JsonException */ public function unmarkAction(int $accountId): bool { try { $this->accountToFavoriteService->delete($accountId, $this->session->getUserData()->getId()); return $this->returnJsonResponse(JsonMessage::JSON_SUCCESS, __u('Favorite deleted')); } catch (Exception $e) { processException($e); $this->eventDispatcher->notify('exception', new Event($e)); return $this->returnJsonResponseException($e); } } }