Code Duplication    Length = 14-15 lines in 3 locations

src/Eccube/Repository/CategoryRepository.php 1 location

@@ 150-164 (lines=15) @@
147
     * @throws ForeignKeyConstraintViolationException 外部キー制約違反の場合
148
     * @throws DriverException SQLiteの場合, 外部キー制約違反が発生すると, DriverExceptionをthrowします.
149
     */
150
    public function delete($Category)
151
    {
152
        $this
153
            ->createQueryBuilder('c')
154
            ->update()
155
            ->set('c.sort_no', 'c.sort_no - 1')
156
            ->where('c.sort_no > :sort_no')
157
            ->setParameter('sort_no', $Category->getSortNo())
158
            ->getQuery()
159
            ->execute();
160
161
        $em = $this->getEntityManager();
162
        $em->remove($Category);
163
        $em->flush($Category);
164
    }
165
}
166

src/Eccube/Repository/ClassNameRepository.php 1 location

@@ 82-96 (lines=15) @@
79
     * @throws ForeignKeyConstraintViolationException 外部キー制約違反の場合
80
     * @throws DriverException SQLiteの場合, 外部キー制約違反が発生すると, DriverExceptionをthrowします.
81
     */
82
    public function delete($ClassName)
83
    {
84
        $sortNo = $ClassName->getSortNo();
85
        $this->createQueryBuilder('cn')
86
            ->update()
87
            ->set('cn.sort_no', 'cn.sort_no - 1')
88
            ->where('cn.sort_no > :sort_no')
89
            ->setParameter('sort_no', $sortNo)
90
            ->getQuery()
91
            ->execute();
92
93
        $em = $this->getEntityManager();
94
        $em->remove($ClassName);
95
        $em->flush($ClassName);
96
    }
97
}
98

src/Eccube/Repository/MemberRepository.php 1 location

@@ 109-122 (lines=14) @@
106
     * @throws ForeignKeyConstraintViolationException 外部キー制約違反の場合
107
     * @throws DriverException SQLiteの場合, 外部キー制約違反が発生すると, DriverExceptionをthrowします.
108
     */
109
    public function delete($Member)
110
    {
111
        $this->createQueryBuilder('m')
112
            ->update()
113
            ->set('m.sort_no', 'm.sort_no - 1')
114
            ->where('m.sort_no > :sort_no')
115
            ->setParameter('sort_no', $Member->getSortNo())
116
            ->getQuery()
117
            ->execute();
118
119
        $em = $this->getEntityManager();
120
        $em->remove($Member);
121
        $em->flush($Member);
122
    }
123
}
124