Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class "ReflectionClass" is not cloneable #40

Closed
roldan opened this issue Jun 10, 2016 · 1 comment
Closed

Class "ReflectionClass" is not cloneable #40

roldan opened this issue Jun 10, 2016 · 1 comment

Comments

@roldan
Copy link

roldan commented Jun 10, 2016

Hi,

i'm getting this error when i follow README instructions for installing.

Class "ReflectionClass" is not cloneable.

This is my code (my "duplicate" controller):

$em = $this->getDoctrine()->getEntityManager();
$entity = $em->getRepository("AppBundle:MyEntity")->find($id); 
$deepCopy = new DeepCopy(); 
$clone = $deepCopy->copy($entity); 
$clone->setName("Copy of " . $clone->getName()); 
$em->persist($clone); 
$em->flush();

Thanks!

@mnapoli
Copy link
Member

mnapoli commented Jun 12, 2016

Duplicates #18, this is probably because your entity is a Doctrine proxy which contains a reference to a lot of other objects that you don't want to clone.

@mnapoli mnapoli closed this as completed Jun 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants