Doctrine fetch: EXTRA_LAZY, LAZY, EAGER
Fetch means whether a related entity or collection will be additionally fetched. For example, is it necessary to get the Photo entity along with getting the Product entity? There are several fetch strategies: EXTRA_LAZY - related collection will not be fetched until the collection method is called, except for these methods contains($entity) , containsKey($key) , count() , get($key) , slice($offset, $length = null) , add($entity) . Adding an entity in this way will also not cause the collection to be fetched: $collection[] = $entity LAZY - related entity or collection will not be fetched until the entity property or collection method is called EAGER - related entity or collection will always be fetched The EXTRA_LAZY strategy is used for collections, LAZY and EAGER for entities. By default, all relation types use the LAZY strategy. Rules for setting strategies: For relation OneToOne fit EAGER For relation OneToMany , fit EXTRA_LAZY For relation ManyToOne , fi...