Code Duplication    Length = 7-7 lines in 2 locations

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

@@ 224-230 (lines=7) @@
221
222
                        $array[$key] = $this->$key->format($dateFormat);
223
                    }
224
                } elseif (is_object($this->$key) && $this->$key instanceof ArrayCollection || $this->$key instanceof PersistentCollection) {
225
                    $ids = [];
226
                    foreach ($this->$key->getValues() as $item) {
227
                        $ids[] = $item->getId();
228
                    }
229
                    $array[$key] = $ids;
230
                } elseif (method_exists($this->$key, 'getId')) {
231
                    $array[$key] = $this->$key->getId();
232
                } else {
233
                    $array[$key] = $this->$key;

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

@@ 218-224 (lines=7) @@
215
                            }
216
                            $array[$key] = $this->$key->format($dateFormat);
217
                        }
218
                    } elseif ($this->$key instanceof ArrayCollection || $this->$key instanceof PersistentCollection) {
219
                        $ids = [];
220
                        foreach ($this->$key->getValues() as $item) {
221
                            $ids[] = $item->getId();
222
                        }
223
                        $array[$key] = $ids;
224
                    } else {
225
                        $array[$key] = $this->$key->getId();
226
                    }
227
                } else {