Skip to content

Instantly share code, notes, and snippets.

@umpirsky
Created July 7, 2012 13:29
Show Gist options
  • Save umpirsky/3066488 to your computer and use it in GitHub Desktop.
Save umpirsky/3066488 to your computer and use it in GitHub Desktop.
<?php
/**
* @Assert\Callback(methods={"validateFile"})
*/
class File
{
public function validateFile(ExecutionContext $context)
{
if (null !== $this->getId()) {
return;
}
$context->setPropertyPath($context->getPropertyPath().'.file');
$validator = new NotBlankValidator();
$validator->initialize($context);
$validator->validate($this->getFile(), new NotBlank());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment