| Conditions | 4 |
| Paths | 6 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 421 | public function create(DocumentManager $dm, array $mapping, ?BaseCollection $coll = null) : PersistentCollectionInterface |
|
| 21 | { |
||
| 22 | 421 | if ($coll === null) { |
|
| 23 | 247 | $coll = ! empty($mapping['collectionClass']) |
|
| 24 | 6 | ? $this->createCollectionClass($mapping['collectionClass']) |
|
| 25 | 247 | : new ArrayCollection(); |
|
| 26 | } |
||
| 27 | |||
| 28 | 421 | if (empty($mapping['collectionClass'])) { |
|
| 29 | 419 | return new PersistentCollection($coll, $dm, $dm->getUnitOfWork()); |
|
| 30 | } |
||
| 31 | |||
| 32 | 7 | $className = $dm->getConfiguration()->getPersistentCollectionGenerator() |
|
| 33 | 7 | ->loadClass($mapping['collectionClass'], $dm->getConfiguration()->getAutoGeneratePersistentCollectionClasses()); |
|
| 34 | |||
| 35 | 7 | return new $className($coll, $dm, $dm->getUnitOfWork()); |
|
| 36 | } |
||
| 37 | |||
| 47 |