양식 구성 요소없이 자체적으로 Symfony 검사기를 사용하고 있습니다.Symfony 하위 엔티티 만 유형으로 유효성 검사 중입니다. 자체 유효성 검사를 건너 뜁니다.
저는 하위 엔티티가 포함 된 엔티티가 있습니다. 현재이 필드가 하위 엔티티의 인스턴스임을 검증 할 수 있지만 제약 조건에 대해 하위의 유효성을 검사해야합니다.
#validation.yml
# This is the entity I'm validating against, it checks the type but doesn't then validate
# it against the child entity below.
Greg\PropertyBundle\Entity\Property:
properties:
property_id:
- NotBlank: ~
- Type:
type: string
addresses:
- All:
- Type:
type: Greg\PropertyBundle\Entity\Address
# child entity
Greg\PropertyBundle\Entity\Address:
properties:
city:
- NotBlank: ~
- Type:
type: string
내 서비스 중 하나에 DI와 함께 전달하고하고있어 발리를 호출하려면이 :
// Validate the data
$errorList = $this->validator->validate($data);
나는 또한 다음 플래그를 전달하여 그것을 시도했다 :
을$errorList = $this->validator->validate($data, null, true, true);
는 속성 개체입니다, 당신은 $ 데이터의 유효성을 검사하는 것을 시도했다 - 주소? –