I have a doctrine entity which has categories so to set a category to the entity i need to call
$category = $categoryRepository->find($categoryId);
$entity->addCategory($category);
Is it possible to set it without the repository with only the ID?