2012-11-06 2 views
0

엔티티 속성 :심포니에 주석 validatation 작동하지 2.1

/** 
* @var string $content 
* 
* @ORM\Column(name="content", type="string", length=300) 
* @Assert\NotBlank(message="Please enter question") 
* @Assert\Length(
* min = "15", 
* max = "300", 
* minMessage = "Text question must be larger than 15 symbol", 
* maxMessage = "Text question must be less than 300 symbol" 
*) 
*/ 
protected $content; 

양식 (컨트롤러) 제출 :

// Add questions 
if ($request->getMethod() === 'POST') { 
    $formQuestion->bind($request); 

    if ($formQuestion->isValid()) { 
    // Here code save question 
    } 
    else { 
    $errors = $formQuestion->getErrors(): 
    // Null array ((
    } 
} 

오류 쇼 (( 가 왜 주석 검증을 읽을 다른 속성이 좋다. 유효성 검사.

+0

POST 체크 외부에 bind()를 넣으려고 했습니까? – alex88

답변

1
is you set form reset tag in your twig template 

like this 
{{ form_rest(form) }} 
관련 문제