Q
Q
Qwyu_4iLofK2022-04-15 12:32:52
Doctrine ORM
Qwyu_4iLofK, 2022-04-15 12:32:52

How to solve the problem of saving multiple entities?

Please tell me what is the difference between the 2 codes:
1)

public function setSave()
    {
        $this->entityManager->flush();
    }


2)
public function setSave2(EntityMS $entityMS)
    {
        $this->entityManager->merge($entityMS);
        $this->entityManager->flush();
        $this->entityManager->clear();
    }


save problem why code 2 handles better than the first one.

I am storing three entities in a repository function. I don't understand why the first code doesn't work, the second one does.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question