Code Duplication    Length = 8-9 lines in 2 locations

src/Repository/UserRepository.php 2 locations

@@ 21-29 (lines=9) @@
18
     * @return UserInterface
19
     * @throws \Doctrine\ORM\OptimisticLockException
20
     */
21
    public function save(UserInterface $user)
22
    {
23
        if(!$user->getID()) {
24
            $this->_em->persist($user);
25
        }
26
        $this->_em->flush($user);
27
        $this->_em->flush($user->getPerson());
28
        return $user;
29
    }
30
31
    /**
32
     * @param UserInterface $user
@@ 36-43 (lines=8) @@
33
     * @param bool $deletePerson
34
     * @throws \Doctrine\ORM\OptimisticLockException
35
     */
36
    public function delete(UserInterface $user, $deletePerson = false)
37
    {
38
        if($deletePerson) {
39
            $this->_em->remove($user->getPerson());
40
        }
41
        $this->_em->remove($user);
42
        $this->_em->flush($user);
43
    }
44
45
    /**
46
     * @param UserCriteria $criteria