-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
In the day 6, with SF 4, we could extend ServiceEntityRepository for the repositories as per the symfony doc
It allows you to use autowiring and thus less boiler plate.
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
class CategoryRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Category::class);
}
...
}
and then in the JobController
use App\Repository\CategoryRepository;
...
public function list(CategoryRepository $categoryRepository) : Response
{
$categories = $categoryRepository->findWithActiveJobs();
return $this->render('job/list.html.twig', [
'categories' => $categories,
]);
}
Anyway it also works with EntityRepository.
Thanks for the great Job.
Metadata
Metadata
Assignees
Labels
No labels