Ngay bây giờ, tôi có một tệp được gọi là validation.yml với xác thực của tất cả các thực thể của nhóm trong một tệp.Trong Symfony2, tệp validation.yml có thể được chia thành nhiều tệp bằng cách sử dụng nhập không?
validation.yml
Blogger\BlogBundle\Entity\Comment
properties:
username:
- NotBlank:
message: You must enter your name
- MaxLength: 50
comment:
- NotBlank:
message: You must enter a comment
- MinLength: 50
Blogger\BlogBundle\Entity\Enquiry:
properties:
name:
- NotBlank: ~
email:
- Email:
message: symblog does not like invalid emails. Give me a real one!
subject:
- NotBlank: ~
- MaxLength: 50
body:
- MinLength: 50
Nhưng tôi muốn chia nó thành hai tập tin và nhập chúng cả. Đây là những gì tôi đã cố gắng và nó đã không làm việc:
validation.yml
imports:
- { resource: comment.yml }
- { resource: enquiry.yml }
comment.yml
Blogger\BlogBundle\Entity\Comment
properties:
username:
- NotBlank:
message: You must enter your name
- MaxLength: 50
comment:
- NotBlank:
message: You must enter a comment
- MinLength: 50
enquiry.yml
Blogger\BlogBundle\Entity\Enquiry:
properties:
name:
- NotBlank: ~
email:
- Email:
message: symblog does not like invalid emails. Give me a real one!
subject:
- NotBlank: ~
- MaxLength: 50
body:
- MinLength: 50
Ý anh là gì "không làm việc" ? Là một ngoại lệ ném, hoặc không có gì xảy ra? – Problematic
Biểu mẫu được gửi mà không xác thực chính xác, không nên xảy ra. – intrepion