title: Symfony2 Doctrine2 - how convert entity (not fetched form database) to array
body: <p>I have entity from form framework.</p>
  
  <pre><code>    public function editAction($id)
      {
          $request = $this-&gt;getRequest();
          $r = $this-&gt;getProfileRepository();
          $profile = $id ? $r-&gt;find($id) : 
              new \Alden\BonBundle\Entity\Profile();
          /* @var $profile \Alden\BonBundle\Entity\Profile */
          $form = $this-&gt;createForm(
              new \Alden\BonBundle\Form\Type\ProfileType(), 
              $profile);
          if ($request-&gt;getMethod() == 'POST')
          {
              $form-&gt;bindRequest($request);
              if ($form-&gt;isValid())
              {
              ...
  </code></pre>
  
  <p>I need to convert <code>$profile</code> into array. In class <code>Profile</code> all properties are defined as private so I can't iterate like <code>foreach($profile as $key =&gt; $value) {...}</code></p>