Answer the question
In order to leave comments, you need to log in
What to do with [Semantical Error] symfony 2 error?
There is this code:
<?php
namespace Test\TestBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="answers")
*/
class Answers{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="QuestionAnswers", inversedBy="answers")
**/
protected $questionAnswer;
/**
* @ORM\Column(type="string", length=250)
* @Assert\NotBlank()
* @Assert\MinLength(5)
* @Assert\MaxLength(250)
*/
protected $answer;
/**
* @ORM\Column(type="boolean" )
*/
protected $rightAnswer=false;}
php app/console doctrine:schema:update --force
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@Symfony\Component\Validator\Constraints
\MinLength" in property ForaSoft\TestBundle\Entity\Answers::$answer does no
t exist, or could not be auto-loaded.
Answer the question
In order to leave comments, you need to log in
The MinLength class has been removed since version 2.3, I don't remember exactly. Instead, you should use the Length class with min or max keys.
/**
* @ORM\Column(type="string", length=250)
* @Assert\NotBlank()
* @Assert\Length(min=5, max =250)
*/
protected $answer;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question