O
O
Oleg-Ukraine2017-08-16 10:55:27
symfony
Oleg-Ukraine, 2017-08-16 10:55:27

Lazy loading in symfony, doctrine?

Hello everyone, just starting to get acquainted with the symphony. I did not find a convenient answer in the documentation, so do not judge strictly for a "beginner" question. In Laravel, Yii2, in order to pick up related entities, it was enough to use the with('relation') keyword with the relation described in the relation model.
I have such a relation described for an entity in symphony, but how can I tie the associated characteristicValue to the product in a request?

manyToMany:
        characteristicValue:
            targetEntity: CharacteristicValue
            cascade: {  }
            fetch: LAZY
            mappedBy: null
            inversedBy: product
            joinTable:
                name: product_has_characteristic_values
                joinColumns:
                    -
                        name: product_id
                        referencedColumnName: id
                inverseJoinColumns:
                    -
                        name: characteristic_value_id
                        referencedColumnName: id
            orderBy: null

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Skobkin, 2017-08-16
@Oleg-Ukraine

1. Specify the related entity in the SELECT and JOIN query.
2. Make setFetchMode() on the request object.
3. Make an EAGER connection (but it's better to think carefully if it's worth it).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question