| Conditions | 6 |
| Paths | 9 |
| Total Lines | 27 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function load( |
||
| 23 | ArrayCollection $entities, |
||
| 24 | ClassMetadataAdapter $classMetadataAdapter |
||
| 25 | ) { |
||
| 26 | $uninitializedProxies = new ArrayCollection(); |
||
| 27 | foreach ($entities->getValues() as $entity) { |
||
| 28 | if ($entity instanceof Proxy && !$entity->__isInitialized()) { |
||
| 29 | $uninitializedProxies->add($entity); |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | if ($uninitializedProxies->isEmpty()) { |
||
| 34 | return; |
||
| 35 | } |
||
| 36 | |||
| 37 | foreach ($this->chunkingStrategy->chunk($uninitializedProxies) as $uninitializedProxiesChunk) { |
||
| 38 | $queryBuilder = $classMetadataAdapter->createQueryBuilder('e'); |
||
| 39 | |||
| 40 | $queryBuilder |
||
| 41 | ->andWhere( |
||
| 42 | $queryBuilder->expr()->in( |
||
| 43 | 'e', |
||
| 44 | $classMetadataAdapter->getIdentifierValueForMany($uninitializedProxiesChunk)->getValues() |
||
| 45 | ) |
||
| 46 | ) |
||
| 47 | ->getQuery() |
||
| 48 | ->execute(); |
||
| 49 | } |
||
| 52 |