Example #1
0
 /**
  * Validation constraints for request data validation
  * @return Assert\Collection
  */
 public function getValidationConstraints()
 {
     return new Assert\Collection(['type' => new Assert\Required([new Assert\NotBlank(), new Assert\Choice(['choices' => DocumentTypeProvider::getAllDocumentTypes()])]), 'phone' => new Assert\Required([new Assert\NotBlank(), new Phone()]), 'code' => new Assert\Required([new Assert\NotBlank(), new Code()]), $this->type => new Assert\Collection([]), 'language' => new Assert\Optional(), 'message' => new Assert\Optional(), 'timestamp' => new Assert\Optional()]);
 }
Example #2
0
 /**
  * Validation constraints for fields
  * @return array
  */
 public function getValidationConstraints()
 {
     return new Assert\Collection(['type' => new Assert\Required([new Assert\NotBlank(), new Assert\Choice(['choices' => DocumentTypeProvider::getPrimaryDocumentTypes()])]), 'file' => new Assert\Collection(['name' => new Assert\Required([new Assert\NotBlank()]), 'content' => new Assert\Required([new Assert\NotBlank()]), 'digest' => new Assert\Required([new Assert\NotBlank()])])]);
 }
 public function testGetPrimaryDocumentTypes()
 {
     $this->assertEquals(3, count(DocumentTypeProvider::getPrimaryDocumentTypes()));
 }
Example #4
0
 /**
  * Validation constraints for fields
  * @return array
  */
 public function getValidationConstraints()
 {
     return new Assert\Collection(['certificate' => new Assert\Required([new Assert\NotBlank()]), 'type' => new Assert\Required([new Assert\NotBlank(), new Assert\Choice(['choices' => DocumentTypeProvider::getAllDocumentTypes()])]), 'timestamp' => new Assert\Required([new Assert\Type(['type' => 'bool'])]), 'language' => new Assert\Required([new Assert\Choice(['choices' => ['LT', 'EN']])]), $this->type => new Assert\Collection([])]);
 }