Code Duplication    Length = 7-7 lines in 2 locations

src/Doctrine/ODM/MongoDB/Entities/BaseEntity.php 1 location

@@ 268-274 (lines=7) @@
265
266
                        $array[$key] = $this->$key->format($dateFormat);
267
                    }
268
                } elseif (is_object($this->$key) && $this->$key instanceof ArrayCollection || $this->$key instanceof PersistentCollection) {
269
                    $ids = [];
270
                    foreach ($this->$key->getValues() as $item) {
271
                        $ids[] = $item->getId();
272
                    }
273
                    $array[$key] = $ids;
274
                } elseif (method_exists($this->$key, 'getId')) {
275
                    $array[$key] = $this->$key->getId();
276
                } else {
277
                    $array[$key] = $this->$key;

src/Doctrine/ORM/Entities/BaseEntity.php 1 location

@@ 245-251 (lines=7) @@
242
                            }
243
                            $array[$key] = $this->$key->format($dateFormat);
244
                        }
245
                    } elseif ($this->$key instanceof ArrayCollection || $this->$key instanceof PersistentCollection) {
246
                        $ids = [];
247
                        foreach ($this->$key->getValues() as $item) {
248
                            $ids[] = $item->getId();
249
                        }
250
                        $array[$key] = $ids;
251
                    } else {
252
                        $array[$key] = $this->$key->getId();
253
                    }
254
                } else {