Doctrine find method return Proxies \ ClassProy

I am working with symfony 2.0.17 I am trying to get an object using the method find($id)that provides Doctrine. Usually it returns a specific Entity representing the database row. But in this case, it returns the view Proxy, and I don't know why ...

Here is my code:

$em = $this->getDoctrine()->getEntityManager();    
$entity =  $em->getRepository('AppBundle:Entityname')->find($id);
var_dump($entity);die;
...
...

The result is as follows:

object(Proxies\AppBundleEntityEntitynameProxy)[4648]
public '__isInitialized__' => boolean true
  private 'id' (AppBundle\Entity\Entityname) => int 1
  private 'type' (AppBundle\Entity\Entityname) => null
  private 'name' (AppBundle\Entity\Entityname) => string 'My custom name' (length=19)

Thanks in advance!

+4
source share

Source: https://habr.com/ru/post/1649321/


All Articles