1 | <?php |
||
23 | class FileOwnerValidator extends ConstraintValidator |
||
24 | { |
||
25 | /** |
||
26 | * @var \Doctrine\Common\Persistence\ObjectManager |
||
27 | */ |
||
28 | protected $em; |
||
29 | |||
30 | /** |
||
31 | * @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface |
||
32 | */ |
||
33 | protected $tokenStorage; |
||
34 | |||
35 | /** |
||
36 | * Constructor |
||
37 | * |
||
38 | * @param \Doctrine\Common\Persistence\ObjectManager $em |
||
39 | * @param \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage |
||
40 | */ |
||
41 | public function __construct(ObjectManager $em, TokenStorageInterface $tokenStorage) |
||
46 | |||
47 | /** |
||
48 | * Validate that the submitted file is owned by the authenticated user |
||
49 | * |
||
50 | * @param string $value |
||
51 | * @param Constraint $constraint |
||
52 | */ |
||
53 | public function validate($value, Constraint $constraint) |
||
87 | |||
88 | /** |
||
89 | * Create violation for validator |
||
90 | * |
||
91 | * @param string $value |
||
92 | * @param Constraint $constraint |
||
93 | */ |
||
94 | protected function createViolation($value, Constraint $constraint) |
||
102 | } |
||
103 |