Code Duplication    Length = 8-8 lines in 2 locations

Persister/Persister.php 2 locations

@@ 174-181 (lines=8) @@
171
            $oneToMany = $this->relationFactory->create(DataMapper::RELATION_ONE_TO_MANY, $relation);
172
            $foreignValue = $entity->getProperty($oneToMany->getJoinColumnReferencedColumnName());
173
            $parentIdent = $entity->getIdentifier();
174
            if (is_null($foreignValue) && !empty($parentIdent)) {
175
                $foreignValue = $this->provider->getColumnValueWhere(
176
                    $entity->getTable(),
177
                    $oneToMany->getJoinColumnReferencedColumnName(),
178
                    key($parentIdent),
179
                    current($parentIdent)
180
                );
181
            }
182
            if (is_null($foreignValue)) {
183
                throw new Exception("Unable to get an identifier. (Table: {$entity->getTable()})");
184
            }
@@ 219-226 (lines=8) @@
216
            $manyToMany = $this->relationFactory->create(DataMapper::RELATION_MANY_TO_MANY, $relation);
217
            $foreignValue = $entity->getProperty($manyToMany->getJoinColumnReferencedColumnName());
218
            $parentIdent = $entity->getIdentifier();
219
            if (is_null($foreignValue) && !empty($parentIdent)) {
220
                $foreignValue = $this->provider->getColumnValueWhere(
221
                    $entity->getTable(),
222
                    $manyToMany->getJoinColumnReferencedColumnName(),
223
                    key($parentIdent),
224
                    current($parentIdent)
225
                );
226
            }
227
            if (is_null($foreignValue)) {
228
                throw new Exception("Unable to get an identifier. (Table: {$entity->getTable()})");
229
            }