doctrine use entity code example
Example 1: symfony findby
$repository = $this->getDoctrine()->getRepository(Product::class);
$product = $repository->find($id);
$product = $repository->findOneBy(['name' => 'Keyboard']);
$product = $repository->findOneBy([
'name' => 'Keyboard',
'price' => 1999,
]);
$products = $repository->findBy(
['name' => 'Keyboard'],
['price' => 'ASC']
);
$products = $repository->findAll();
Example 2: doctrine orm get all
$records = $em->getRepository("Entities\YourTargetEntity")->findAll();