I
I
Ivan Antonov2016-03-02 17:31:08
symfony
Ivan Antonov, 2016-03-02 17:31:08

How to essentially set the id to the field with the link instead of initializing the whole class?

The database is being migrated, and if each class is initialized, this will greatly affect the speed of the work. What are the possibilities of turning this code:

$user  = $em->getRepository('AppBundle:User')->find($o['id_user']);
$offer = new Offer();
$offer->setUser($user);

In that:
$offer = new Offer();
$offer->setUser($o['id_user']);

?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2016-03-02
@antonowano

doctrine-orm.readthedocs.org/projects/doctrine-orm...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question