Symfony2 "@Type" in property Genius\ProfileBundle\Entity\Profil::$actualites was never imported [closed]

StackOverflow https://stackoverflow.com/questions/23604616

Question

I am new to Symfony2 in general. This issue relates to JMS Serializer annotations and FOSRestBundle though.

I have the following Profile.php Entity with an Actualite Field that i'm looking to set them as an Array through Type Annotation.

class Profile  {
...

     /**
     * @ORM\OneToMany(targetEntity="Genius\ProfileBundle\Entity\Actualite", mappedBy="profil",cascade={"persist"}, cascade={"persist", "remove"})
     */


     /**
     * @Type("array<Actualite>")
     */
    private $actualites;
...
}

But i'm getting the following error :

"@Type" in property Genius\ProfileBundle\Entity\Profil::$actualites was never imported.

To solve the problem i had add the following line but the problem still :

use Genius\ProfileBundle\Entity\Actualite;
Was it helpful?

Solution

Have you insert this "use" in your Profile entity ?

use JMS\Serializer\Annotation\Type;

EDIT :

You have set your

@Type("array<Actualie>")

But I think it's

@Type("array<Actualite>")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top