Doctrine findAll method returns the same id on all lines

0

I'm doing a search that returns all my Entity data.

It happens that it returns me all the data but with the same id, but I checked the database the ids are different.

.
$entityManager->clear();
        print_r($entityManager->getRepository('models\AlarmesNcc')->findAll());
        $entityManager->flush();

Returning

Array
(
    [0] => models\AlarmesNcc Object
        (
            [id:models\AlarmesNcc:private] => 1 /aqui nesta linha
            [criated:models\AlarmesNcc:private] => dd
            [severity:models\AlarmesNcc:private] => ssss
            [deviceService:models\AlarmesNcc:private] => ss
            [details:models\AlarmesNcc:private] => sss
            [usuario:models\AlarmesNcc:private] => 1
        )

    [1] => models\AlarmesNcc Object
        (
            [id:models\AlarmesNcc:private] => 1 /aqui nesta linha
            [criated:models\AlarmesNcc:private] => dd
            [severity:models\AlarmesNcc:private] => ssss
            [deviceService:models\AlarmesNcc:private] => ss
            [details:models\AlarmesNcc:private] => sss
            [usuario:models\AlarmesNcc:private] => 1
        )

)
    
asked by anonymous 03.10.2014 / 16:40

1 answer

1

I solved, the problem was in the doctrine notes

I was like this

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

Because when I generated the annotation my table with field id was tynint type

I changed the id in the table to int and changed the annotation by doing this

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

worked perfectly

    
07.10.2014 / 18:01