create empty copy of another instance in symfony

Is it possible to copy an instance of an entity in symfony without its values ?
For example i have the following Entity

class Dog{
private $_name;
__construct(){
$this->_name = null;
}
}
setName($name){
$this->_name = $name;
return $this;
}

getName(){
return $this->_name;
}

}

$billy = new Dog();
$billy->setName('billy')

Can i get copy “$billy” to get a new instance without the value “billy” for the name parameter ?

I know i can copy it and set a new Name or i can just create a new instance of it using new Dog() but is a method exist to do it this way ?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *