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