user3816170
user3816170

Reputation: 321

Semantical Error ;The annotation "@Symfony\Component\Validator\Constraints\MinLength"

Using Validator I have this Error

[Semantical Error] The annotation "@Symfony\Component\Validator\Constraints\MinLength" in property My\testBundle\Entity\Desk::$title does not exist, or could not be auto-loaded.

namespace My\testBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
* Desk
*
* @ORM\Table(name="desk")
* @ORM\Entity(repositoryClass="My\testBundle\Repository\DeskRepository")
*/
class Desk
{
/**
 * @ORM\OneToMany(targetEntity="DeskComment", mappedBy="desk", cascade={"remove", "persist"})
 */
protected $comments;
/**
 * @var integer
 *
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
 * @var string
 * 
 *
 * @ORM\Column(name="title", type="string", length=255)
 * @Assert\NotBlank()
 * @Assert\MinLength(
 *     limit=3,
 *     message="Your name must have at least {{ limit }} characters."
 * )
 */
private $title;

/**
 * @var string
 *
 * @ORM\Column(name="symmary", type="text")
 */
private $symmary;

/**
 * @var string
 *
 * @ORM\Column(name="description", type="text")
 */
private $description;

/**
 * @var string
 *
 * @ORM\Column(name="note", type="decimal", nullable=true)
 */
private $note;

The problem is @Assert\MinLength.

Any help?

Upvotes: 2

Views: 4625

Answers (1)

qooplmao
qooplmao

Reputation: 17759

Use Length with min instead.

From the docs.

The MinLength constraint is deprecated since version 2.1 and will be removed
in Symfony 2.3. Use Length with the min option instead.

Upvotes: 1

Related Questions