Skip to content

Instantly share code, notes, and snippets.

@nebkam
Last active June 15, 2022 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nebkam/087bb66e07821cebd1b07c4316499cca to your computer and use it in GitHub Desktop.
Save nebkam/087bb66e07821cebd1b07c4316499cca to your computer and use it in GitHub Desktop.
<?php
// Before
public function showAllUsers(EntityManagerInterface $em)
{
$users = $em->getRepository(User::class)->findAll();
return $this->json($users);
}
// After
public function showAllUsers(UserRepository $userRepository)
{
$users = $userRepository->findAll();
return $this->json($users);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment