mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-03 13:33:48 +00:00
add validation of existing file
This commit is contained in:
@@ -6,7 +6,8 @@ use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
|
||||
use ChampsLibres\AsyncUploaderBundle\Validator\Constraints\AsyncFileExists;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\MappedSuperclass()
|
||||
@@ -22,6 +23,9 @@ class Document implements HasScopeInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
* @Assert\Length(
|
||||
* min=2, max=250
|
||||
* )
|
||||
*/
|
||||
private $title;
|
||||
|
||||
@@ -44,6 +48,7 @@ class Document implements HasScopeInterface
|
||||
* targetEntity="Chill\DocStoreBundle\Entity\StoredObject",
|
||||
* cascade={"persist"}
|
||||
* )
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
private $object;
|
||||
|
||||
|
@@ -6,6 +6,7 @@ namespace Chill\DocStoreBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use ChampsLibres\AsyncUploaderBundle\Model\AsyncFileInterface;
|
||||
use ChampsLibres\AsyncUploaderBundle\Validator\Constraints\AsyncFileExists;
|
||||
|
||||
/**
|
||||
* Represent a document stored in an object store
|
||||
@@ -14,6 +15,9 @@ use ChampsLibres\AsyncUploaderBundle\Model\AsyncFileInterface;
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table("chill_doc.stored_object")
|
||||
* @AsyncFileExists(
|
||||
* message="The file is not stored properly"
|
||||
* )
|
||||
*/
|
||||
class StoredObject implements AsyncFileInterface
|
||||
{
|
||||
|
Reference in New Issue
Block a user