Code Duplication    Length = 7-12 lines in 3 locations

lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php 1 location

@@ 173-179 (lines=7) @@
170
    /**
171
     * {@inheritDoc}
172
     */
173
    public function slice(PersistentCollection $collection, $offset, $length = null)
174
    {
175
        $mapping   = $collection->getMapping();
176
        $persister = $this->uow->getEntityPersister($mapping['targetEntity']);
177
178
        return $persister->getManyToManyCollection($mapping, $collection->getOwner(), $offset, $length);
179
    }
180
    /**
181
     * {@inheritdoc}
182
     */

lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php 2 locations

@@ 101-112 (lines=12) @@
98
    /**
99
     * {@inheritdoc}
100
     */
101
    public function count(PersistentCollection $collection)
102
    {
103
        $mapping   = $collection->getMapping();
104
        $persister = $this->uow->getEntityPersister($mapping['targetEntity']);
105
106
        // only works with single id identifier entities. Will throw an
107
        // exception in Entity Persisters if that is not the case for the
108
        // 'mappedBy' field.
109
        $criteria = new Criteria(Criteria::expr()->eq($mapping['mappedBy'], $collection->getOwner()));
110
111
        return $persister->count($criteria);
112
    }
113
114
    /**
115
     * {@inheritdoc}
@@ 117-123 (lines=7) @@
114
    /**
115
     * {@inheritdoc}
116
     */
117
    public function slice(PersistentCollection $collection, $offset, $length = null)
118
    {
119
        $mapping   = $collection->getMapping();
120
        $persister = $this->uow->getEntityPersister($mapping['targetEntity']);
121
122
        return $persister->getOneToManyCollection($mapping, $collection->getOwner(), $offset, $length);
123
    }
124
125
    /**
126
     * {@inheritdoc}