Comments (2)
but does not update the Timeslices Field in Activity
Yes that's intended, the clone should replace magically the original object where the original object was referenced.
I think it's something you need to handle yourself because it's not a generic behavior. Likewise you might want to add the new object to the collection, or replace the original one. It's not so obvious what should happen and depends on your use case.
from deepcopy.
You can achieve this by creating a Filter who call setter instead of pass value by reference. In that way just implement the sync logic in your setter method. You can use the symfony propertyAccess component to do it in the most easy way if you do not have dependencies constraints (http://symfony.com/doc/current/components/property_access/introduction.html).
E.g (take from the first blog post about it I found, full here : http://culttt.com/2014/07/21/working-relationships-doctrine-2), here he add a cribb object on user, and sync the cribb object with the user, user is the current class ($this)
/**
* Add the user to a Cribbb
*
* @param Cribbb $cribbb
* @return void
*/
public function addToCribbb(Cribbb $cribbb)
{
$cribbb->addUser($this);
$this->cribbbs[] = $cribbb;
}
from deepcopy.
Related Issues (20)
- PHP 7.4: Cloning of "uninitialized" typed properties not currently possible HOT 1
- Running PHPUnit 8.5.1 got deprecation HOT 1
- Problem when using Symfony 4.4.x and Doctrine 2.7.x: Cannot bind closure to scope of internal class ReflectionProperty
- re-install Laravel website problems HOT 2
- doc\clone.png failed to open stream HOT 2
- Does not properly clone classes inherited from ArrayObject
- Deprecation warning
- error when installing laravel 6
- proc_open(): CreateProcess failed, error code - 5 HOT 1
- Support cloning objects of ArrayAccess
- Infinite loop when trying to copy "recursive" array HOT 2
- Filters are not applied to doctrine Collection values HOT 1
- What about Version 2 HOT 6
- readonly properties in constructor HOT 3
- phpspec/prophecy is now explicitely needed for tests HOT 1
- \DeepCopy\DeepCopy::$hashMap collisions HOT 1
- Clone error HOT 1
- DateInterval from_string property not copied in PHP 8.2
- DeepCopy error : The class \"ReflectionClass\" is not cloneable.
- The class \"ContainerKL2EgoF\\App_KernelDevDebugContainer\" is not cloneable. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepcopy.