symfony doctrine migration 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: migration create symfony
doctrine:migrations:generate [generate] Generate a blank migration class.
Example 3: php artisan doctrine migrations add all
php artisan doctrine:migrations:version --all --add