@@ -313,14 +313,14 @@ Now you can see this new code in action! Imagine you're inside a controller::
313313 // ...
314314 use App\Entity\Category;
315315 use App\Entity\Product;
316- use Doctrine\Persistence\ManagerRegistry ;
316+ use Doctrine\ORM\EntityManagerInterface ;
317317 use Symfony\Component\HttpFoundation\Response;
318318 use Symfony\Component\Routing\Annotation\Route;
319319
320320 class ProductController extends AbstractController
321321 {
322322 #[Route('/product', name: 'product')]
323- public function index(ManagerRegistry $doctrine ): Response
323+ public function index(EntityManagerInterface $entityManager ): Response
324324 {
325325 $category = new Category();
326326 $category->setName('Computer Peripherals');
@@ -333,7 +333,6 @@ Now you can see this new code in action! Imagine you're inside a controller::
333333 // relates this product to the category
334334 $product->setCategory($category);
335335
336- $entityManager = $doctrine->getManager();
337336 $entityManager->persist($category);
338337 $entityManager->persist($product);
339338 $entityManager->flush();
@@ -379,9 +378,9 @@ before. First, fetch a ``$product`` object and then access its related
379378
380379 class ProductController extends AbstractController
381380 {
382- public function show(ManagerRegistry $doctrine , int $id): Response
381+ public function show(ProductRepository $productRepository , int $id): Response
383382 {
384- $product = $doctrine->getRepository(Product::class) ->find($id);
383+ $product = $productRepository ->find($id);
385384 // ...
386385
387386 $categoryName = $product->getCategory()->getName();
@@ -412,9 +411,9 @@ direction::
412411 // ...
413412 class ProductController extends AbstractController
414413 {
415- public function showProducts(ManagerRegistry $doctrine , int $id): Response
414+ public function showProducts(CategoryRepository $categoryRepository , int $id): Response
416415 {
417- $category = $doctrine->getRepository(Category::class) ->find($id);
416+ $category = $categoryRepository ->find($id);
418417
419418 $products = $category->getProducts();
420419
@@ -433,7 +432,7 @@ by adding JOINs.
433432 a "proxy" object in place of the true object. Look again at the above
434433 example::
435434
436- $product = $doctrine->getRepository(Product::class) ->find($id);
435+ $product = $productRepository ->find($id);
437436
438437 $category = $product->getCategory();
439438
@@ -503,9 +502,9 @@ object and its related ``Category`` in one query::
503502 // ...
504503 class ProductController extends AbstractController
505504 {
506- public function show(ManagerRegistry $doctrine , int $id): Response
505+ public function show(ProductRepository $productRepository , int $id): Response
507506 {
508- $product = $doctrine->getRepository(Product::class) ->findOneByIdJoinedToCategory($id);
507+ $product = $productRepository ->findOneByIdJoinedToCategory($id);
509508
510509 $category = $product->getCategory();
511510