1

The query

$apartats = $em->getRepository('MyCompanyFrontendBundle:User')->findAll();

returns me an array with the same value in all values.

The numer of objects of returned array are good, but all values are equal than the first row of the table.

Example:

id:1, name:"Peter"  
id:2, name="Sofia"  
id:3, name="David"

Returns me:

id:1, name:"Peter"  
id:1, name:"Peter"  
id:1, name:"Peter"

Why is this?

1
  • 6
    how did you show your result? var_dump? Twig? Can you give us more information? (Entity code, function where you do your findAll,...)
    – Snroki
    Oct 10, 2012 at 12:47

1 Answer 1

-1

Check user entity's annotation

if it is look like this

/**
     * @var boolean $id
     *
     * @ORM\Column(name="id", type="boolean", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */

change it to

/**
         * @var integer $id
         *
         * @ORM\Column(name="id", type="integer", nullable=false)
         * @ORM\Id
         * @ORM\GeneratedValue(strategy="IDENTITY")
         */

and also check user.orm.yml file .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.