Skip to content

Commit 44394f4

Browse files
author
matthieu.robillard
committed
compatibility SF3
Signed-off-by: matthieu.robillard <m@wbx.fr>
1 parent 47ef95c commit 44394f4

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

Entity/File.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77

88
use Symfony\Component\HttpFoundation\File\File AS SymfonyFile;
99
use Symfony\Component\HttpFoundation\File\UploadedFile;
10-
use Symfony\Component\Validator\ExecutionContextInterface;
10+
use Symfony\Component\Validator\Context\ExecutionContextInterface;
1111

1212
/**
1313
* wbx\FileBundle\Entity\File
1414
*
1515
* @Orm\MappedSuperclass
1616
* @ORM\HasLifecycleCallbacks
17-
* @Assert\Callback(methods={"isValid"})
1817
*/
1918
class File {
2019
/**
@@ -815,9 +814,14 @@ protected function fit($w_in, $h_in, $w_box, $h_box, $mode = "in", $upscale = tr
815814
}
816815

817816

817+
/**
818+
* @Assert\Callback
819+
*/
818820
public function isValid(ExecutionContextInterface $context) {
819821
if ($this->file === null && $this->path === null) {
820-
$context->addViolationAt('file', 'wbxfilebundle.validator.error.empty', array(), null);
822+
$context->buildViolation('wbxfilebundle.validator.error.empty')
823+
->atPath('file')
824+
->addViolation();
821825
}
822826
}
823827

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"require": {
1515
"php": ">=5.3.2",
16-
"symfony/framework-bundle": ">=2.3"
16+
"symfony/framework-bundle": ">=3.4"
1717
},
1818
"suggest": {
1919
"liip/imagine-bundle": "*"

0 commit comments

Comments
 (0)