title: Doctrine 2: how to clone all values from one object onto another except ID?
body: <p>In $entity variable, there is an object of same type as $other_address, but with all field values filled in.</p>
  
  <p>I want to set all fields in $other_address object to have exact same values as $entity object.</p>
  
  <p>Is this doable in less then N number of lines, where N is number of fields I need to set?</p>
  
  <p>I tried "clone" keyword, but it didnt work.</p>
  
  <p>Here's the code.</p>
  
  <pre><code>                $other_address = $em-&gt;getRepository('PennyHomeBundle:Address')
            -&gt;findBy(array('user' =&gt; $this-&gt;get('security.context')-&gt;getToken()-&gt;getUser()-&gt;getId(), 'type' =&gt; $check_type));
                  $other_address = $other_address[0];
  
  
                  //I want to set all values in this object to have values from another object of same type
                  $other_address-&gt;setName($entity-&gt;getName());
                  $other_address-&gt;setAddress1($entity-&gt;getAddress1());
                  $other_address-&gt;setAddress2($entity-&gt;getAddress2());
                  $other_address-&gt;setSuburbTown($entity-&gt;getSuburbTown());
                  $other_address-&gt;setCityState($entity-&gt;getCityState());
                  $other_address-&gt;setPostZipCode($entity-&gt;getPostZipCode());
                  $other_address-&gt;setPhone($entity-&gt;getPhone());
                  $other_address-&gt;setType($check_type);
  </code></pre>