Skip to content

Instantly share code, notes, and snippets.

@umpirsky
Created July 7, 2012 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save umpirsky/3066507 to your computer and use it in GitHub Desktop.
Save umpirsky/3066507 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;
}
if (null === $this->getFile()) {
$notBlank = new NotBlank();
$context->addViolationAtSubPath('file', $notBlank->message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment