V
V
Vitaliy2021-07-30 08:12:48
Doctrine ORM
Vitaliy, 2021-07-30 08:12:48

How is it more logical to use the method to insert data into a table, for example Users using Repository in conjunction with Entity?

Good day everyone,

1) Is it more logical to implement CRUD methods in Repository classes using Doctrine ORM without the Symfony framework, or are these methods implemented in controllers or Entity classes?

2) And what are the best methods to use for insert and update in Doctrine ORM without using direct SQL queries?
Thanks to.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Derepko, 2021-07-30
@uDenX

1. Business logic is contained in services and called by the controller. There should be almost no logic in the controller itself
2. Doctrine has a corresponding flush method. For new entities, before calling flush, you need to call persist
https://www.doctrine-project.org/projects/doctrine...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question