Code Duplication    Length = 10-10 lines in 2 locations

src/Relation/ManyToMany.php 2 locations

@@ 171-180 (lines=10) @@
168
        $table = $entityManager->escapeIdentifier($this->table);
169
        $where = [];
170
171
        foreach ($this->reference as $myVar => $fkCol) {
172
            $value = $self->__get($myVar);
173
174
            if ($value === null) {
175
                throw new IncompletePrimaryKey('Key incomplete to save foreign key');
176
            }
177
178
            $where[] = $entityManager->escapeIdentifier($fkCol) . ' = ' .
179
                       $entityManager->escapeValue($value);
180
        }
181
182
        foreach ($entities as $entity) {
183
            if (!$entity instanceof $this->class) {
@@ 188-197 (lines=10) @@
185
            }
186
187
            $condition = [];
188
            foreach ($this->getOpponent()->getReference() as $hisVar => $fkCol) {
189
                $value = $entity->__get($hisVar);
190
191
                if ($value === null) {
192
                    throw new IncompletePrimaryKey('Key incomplete to save foreign key');
193
                }
194
195
                $condition[] = $entityManager->escapeIdentifier($fkCol) . ' = ' .
196
                               $entityManager->escapeValue($value);
197
            }
198
            $where[] = implode(' AND ', $condition);
199
        }
200