Reputation: 21
even doing copy/paste of this constraits, nothing hapens, i have disabled the html validations also, this is the code : twig:
{{form_start(form, {'action':'', 'method':'POST'})}}
{{ form(form, {'attr': {'novalidate': 'novalidate'}}) }}
{{form_end(form)}}
here the class:
class Curso {
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
* @Assert\MaxLength(15)
* @ORM\Column(name="titulo", type="string", length=255)
*/
private $titulo;
/**
* @var string
* @Assert\NotBlank()
* @Assert\Length(
* min = 2,
* max = 50,
* minMessage = "Your first name must be at least {{ limit }} characters long",
* maxMessage = "Your first name cannot be longer than {{ limit }} characters"
* )
* @Assert\Type("string")
* @ORM\Column(name="descripcion", type="string", length=255)
*/
private $descripcion;
/**
* @var float
* @Assert\NotBlank()
* @ORM\Column(name="precio", type="float")
*/
private $precio;
/**
* Get id
* @Assert\NotBlank()
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set titulo
*
* @param string $titulo
*
* @return Curso
*/
public function setTitulo($titulo) {
$this->titulo = $titulo;
return $this;
}
/**
* Get titulo
*
* @return string
*/
public function getTitulo() {
return $this->titulo;
}
/**
* Set descripcion
*
* @param string $descripcion
*
* @return Curso
*/
public function setDescripcion($descripcion) {
$this->descripcion = $descripcion;
return $this;
}
/**
* Get descripcion
*
* @return string
*/
public function getDescripcion() {
return $this->descripcion;
}
/**
* Set precio
*
* @param float $precio
*
* @return Curso
*/
public function setPrecio($precio) {
$this->precio = $precio;
return $this;
}
/**
* Get precio
*
* @return float
*/
public function getPrecio() {
return $this->precio;
}
}
can you tell me what is wrong? sorry about my english, i'm a little rusty :)!!!
Upvotes: 0
Views: 335
Reputation: 9362
You may want to check your app/config.yml
and make sure that the you have annotations enabled for validation
framework:
...
validation: { enable_annotations: true }
Upvotes: 1