| @@ 81-94 (lines=14) @@ | ||
| 78 | /** |
|
| 79 | * {@inheritdoc} |
|
| 80 | */ |
|
| 81 | public function count(PersistentCollection $collection) |
|
| 82 | { |
|
| 83 | $association = $collection->getMapping(); |
|
| 84 | $persister = $this->uow->getEntityPersister($association->getTargetEntity()); |
|
| 85 | ||
| 86 | // only works with single id identifier entities. Will throw an |
|
| 87 | // exception in Entity Persisters if that is not the case for the |
|
| 88 | // 'mappedBy' field. |
|
| 89 | $criteria = [ |
|
| 90 | $association->getMappedBy() => $collection->getOwner(), |
|
| 91 | ]; |
|
| 92 | ||
| 93 | return $persister->count($criteria); |
|
| 94 | } |
|
| 95 | ||
| 96 | /** |
|
| 97 | * {@inheritdoc} |
|
| @@ 99-105 (lines=7) @@ | ||
| 96 | /** |
|
| 97 | * {@inheritdoc} |
|
| 98 | */ |
|
| 99 | public function slice(PersistentCollection $collection, $offset, $length = null) |
|
| 100 | { |
|
| 101 | $association = $collection->getMapping(); |
|
| 102 | $persister = $this->uow->getEntityPersister($association->getTargetEntity()); |
|
| 103 | ||
| 104 | return $persister->getOneToManyCollection($association, $collection->getOwner(), $offset, $length); |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * {@inheritdoc} |
|
| @@ 190-196 (lines=7) @@ | ||
| 187 | /** |
|
| 188 | * {@inheritDoc} |
|
| 189 | */ |
|
| 190 | public function slice(PersistentCollection $collection, $offset, $length = null) |
|
| 191 | { |
|
| 192 | $association = $collection->getMapping(); |
|
| 193 | $persister = $this->uow->getEntityPersister($association->getTargetEntity()); |
|
| 194 | ||
| 195 | return $persister->getManyToManyCollection($association, $collection->getOwner(), $offset, $length); |
|
| 196 | } |
|
| 197 | /** |
|
| 198 | * {@inheritdoc} |
|
| 199 | */ |
|