Wants to convert doctrine entiry object to normal array, this is my code so far,
$demo = $this->doctrine->em->find(\'Entity\\User\',2);
You can try something like this,
$result = $this->em->createQueryBuilder();
$app_code = $result->select('p')
->from('YourUserBundle:User', 'p')
->where('p.id= :id')
->setParameter('id', 2)
->getQuery()
->getResult(\Doctrine\ORM\Query::HYDRATE_ARRAY);
Another way,
$this->em->getRepository('YourUserBundle:User')
->findBy(array('id'=>1));
Above will return an array but contains doctrine objects. Best way to return an array is using the doctrine query.
Hope this helps. Cheers!