Code Duplication    Length = 20-20 lines in 2 locations

src/Mapper/PostVotePostElement.php 1 location

@@ 7-26 (lines=20) @@
4
5
use PlaygroundGame\Mapper\AbstractMapper;
6
7
class PostVotePostElement extends AbstractMapper
8
{
9
    public function removeAll($post)
10
    {
11
        $elements = $this->findBy(array('post' => $post));
12
        foreach ($elements as $element) {
13
            $this->em->remove($element);
14
        }
15
        $this->em->flush();
16
    }
17
18
    public function getEntityRepository()
19
    {
20
        if (null === $this->er) {
21
            $this->er = $this->em->getRepository('PlaygroundGame\Entity\PostVotePostElement');
22
        }
23
24
        return $this->er;
25
    }
26
}
27

src/Mapper/PrizeCategoryUser.php 1 location

@@ 7-26 (lines=20) @@
4
5
use PlaygroundGame\Mapper\AbstractMapper;
6
7
class PrizeCategoryUser extends AbstractMapper
8
{
9
    public function removeAll($user)
10
    {
11
        $categories = $this->findBy(array('user' => $user));
12
        foreach ($categories as $category) {
13
            $this->em->remove($category);
14
        }
15
        $this->em->flush();
16
    }
17
18
    public function getEntityRepository()
19
    {
20
        if (null === $this->er) {
21
            $this->er = $this->em->getRepository('PlaygroundGame\Entity\PrizeCategoryUser');
22
        }
23
24
        return $this->er;
25
    }
26
}
27