myclabs / myclabs/DeepCopy

Add a way to get a hand on a cloned object

Open
#124 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
8.9k
Forks
110
PR merge metrics
No merged PRs in 30d

Description

We have a situation where we have objects that are somehow linked to other structures (an object references a file on disk in our case). When the deep copy of a data tree is performed, the objects are cloned inside, but we also need a hand on the old and new objects together to be able to copy the associated structure at the same time (cp files on disk here).

I don't see a way to do that currently, we thought about the type filter/type replace but we don't want to "manually" clone the object as would be with this filter, we are perfectly good with the normal cloning, we just need to know when one was cloned to perform the additional operations we need.

What would be the best way to do it? Events? Callbacks? Type filters that can be chained?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the deep-copy flow and the existing type filter/type replace approaches mentioned in the issue. Done means defining and documenting a concrete way to observe old and new cloned objects so associated structures can be copied without manually cloning the objects.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.