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

@@ 236-242 (lines=7) @@
233
                            }
234
                            $array[$key] = $this->$key->format($dateFormat);
235
                        }
236
                    } elseif ($this->$key instanceof ArrayCollection || $this->$key instanceof PersistentCollection) {
237
                        $ids = [];
238
                        foreach ($this->$key->getValues() as $item) {
239
                            $ids[] = $item->getId();
240
                        }
241
                        $array[$key] = $ids;
242
                    } else {
243
                        $array[$key] = $this->$key->getId();
244
                    }
245
                } else {