Reputation: 1120
My problem is connected with the fact that the entity field marked with @Gedmo\UploadableFilePath
annotation is ignored by Symfony3. I am using the Uploadable behavior extension for Doctrine2.
In my entity I have:
/**
* @ORM\Column
* @Gedmo\UploadableFileName
*/
private $name;
/*
* @ORM\Column
* @Gedmo\UploadableFilePath
*/
private $path;
At first, I have noticed though that the path
column is not generated in MySQL.
Then I found out that whenever I delete name
field I get the following error:
[Gedmo\Exception\InvalidMappingException] Class "AppBundle\Entity\plik" must have an UploadableFilePath or Uploadable FileName field.
In doctrine-uploadable
documentation I see that:
@Gedmo\Mapping\Annotation\UploadableFilePath: This annotation is used to set which field will receive the path to the file. The field MUST be of type "string". Either this one or UploadableFileName annotation is REQUIRED to be set.
so it seems that I should be able to set $path
field only.
Please advice why is UploadableFilePath
field not being generated and why can't I delete the $name
field?
Upvotes: 1
Views: 265
Reputation: 1120
It seems that I have made a simple typo. There was lack of one *
in the comment line.
/**
* @ORM\Column
* @Gedmo\UploadableFilePath
*/
private $path;
It seems that symfony ignores annotations in such a case.
Upvotes: 0