symfony: [Semantical Error] The annotation does not exist, or could not be auto-loaded.
This model
<?php
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
*/
class Order
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @Assert\NotBlank()
*/
public $date;
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
}
raise this error
[Semantical Error] The annotation "@Symfony\Component\Validator\Constraints\NotBlank" in property Order::$date does not exist, or could not be auto-loaded.
This is because DocParser->autoloadAnnotations is false by default. How can I fix this?
About this issue
- Original URL
- State: closed
- Created 13 years ago
- Comments: 15 (3 by maintainers)
In case anyone else has this issue, with Symfony 3.3, after hours of searching… In all my infinite genius, I had forward-slash in Assert/NotBlank, where a back-slash is the ticket!