Skip to content

Instantly share code, notes, and snippets.

Created Sep 11, 2020
What would you like to do?
namespace Example\FooBundle\Service;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
class FooService
protected $fooRepository;
protected $logger;
public function __construct(
FooRepositoryInterface $fooRepository,
LoggerInterface $logger
) {
$this->fooRepository = $fooRepository;
$this->logger = $logger;
public function query()
$results = $this->fooRepository->fetchLatest();
sprintf('Someone fetched %d foos',
return $results;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment