2
symfony2 양식으로 작업 중입니다. 이제 "이 값은 null이 아니어야합니다."라는 메시지가 나타납니다. 이제 "이 값"은 무엇입니까? 이 값은? 어떻게 알아낼 수 있을까요? 오류를 덤핑으로symfony2가 "이 값은 null이 아니어야합니다."
: ($ 형상 -> getErrors는()) 좀 하나 formError가 사라졌다 주장 toggeling 후
array (size=3)
0 =>
object(Symfony\Component\Form\FormError)[2418]
protected 'messageTemplate' => string 'This value should not be null.' (length=30)
protected 'messageParameters' =>
array (size=0)
empty
protected 'messagePluralization' => null
1 =>
object(Symfony\Component\Form\FormError)[2420]
protected 'messageTemplate' => string 'This value should not be null.' (length=30)
protected 'messageParameters' =>
array (size=0)
empty
protected 'messagePluralization' => null
2 =>
object(Symfony\Component\Form\FormError)[2421]
protected 'messageTemplate' => string 'This value should not be null.' (length=30)
protected 'messageParameters' =>
array (size=0)
empty
protected 'messagePluralization' => null
를 얻을. 그 무엇에 의해 :
/**
* @ORM\Column(type="integer")
* @Assert\NotNull()
*/
protected $price;
var_dump($reservation->getPrice(), is_null($reservation->getPrice()));
결과 : 엔티티에
float 733
boolean false
그러나 이것은 오류이다는 주장에
..실패 :
/**
* @ORM\Column(type="integer")
* @Assert\NotNull()
*/
protected $price;
/**
* @ORM\ManyToOne(targetEntity="Caravan", inversedBy="caravan")
* @ORM\JoinColumn(name="caravan_id", referencedColumnName="id")
* @Assert\NotNull()
*/
protected $caravan;
/**
* @ORM\Column(type="datetime")
* @Assert\NotNull()
*/
protected $created;
사람들은 3 곳이다 isValid 검사 전에 컨트롤러에 설정 한 값입니다. If do :
$form->getData();
올바른 데이터가 있습니다.
뿐만 아니라 형태와 연관된 필터의 덤프를 제공하십시오) = isValid 검사 전에 마지막 순간에 바인딩합니다. –