Merge branch 'issue565_document_storedObject' into 'master'

storedObject: add validation in properties where it is used

See merge request Chill-Projet/chill-bundles!417
This commit is contained in:
Julien Fastré 2022-04-27 07:01:06 +00:00
commit f14c915502
4 changed files with 18 additions and 10 deletions

View File

@ -11,6 +11,10 @@ and this project adheres to
## Unreleased ## Unreleased
<!-- write down unreleased development here --> <!-- write down unreleased development here -->
* [Documents] Validate storedObject and allow for null data (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/565)
* [Activity form] invert 'incoming' and 'receiving' in Activity form
* [Activity form] keep the same order for 'attendee' field in new and edit form
* [list with period] use "sameas" test operator to introduce requestor in list
## Test releases ## Test releases

View File

@ -35,6 +35,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap; use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\SerializedName; use Symfony\Component\Serializer\Annotation\SerializedName;
use Symfony\Component\Validator\Constraints as Assert;
/** /**
* Class Activity. * Class Activity.
@ -93,6 +94,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/** /**
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"}) * @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
* @Assert\Valid(traverse=true)
*/ */
private Collection $documents; private Collection $documents;

View File

@ -149,37 +149,37 @@ class StoredObject implements AsyncFileInterface, Document
return $this; return $this;
} }
public function setDatas(array $datas) public function setDatas(?array $datas)
{ {
$this->datas = $datas; $this->datas = (array) $datas;
return $this; return $this;
} }
public function setFilename($filename) public function setFilename(?string $filename)
{ {
$this->filename = $filename; $this->filename = (string) $filename;
return $this; return $this;
} }
public function setIv(array $iv) public function setIv(?array $iv)
{ {
$this->iv = $iv; $this->iv = (array) $iv;
return $this; return $this;
} }
public function setKeyInfos(array $keyInfos) public function setKeyInfos(?array $keyInfos)
{ {
$this->keyInfos = $keyInfos; $this->keyInfos = (array) $keyInfos;
return $this; return $this;
} }
public function setType(string $type) public function setType(?string $type)
{ {
$this->type = $type; $this->type = (string) $type;
return $this; return $this;
} }

View File

@ -20,6 +20,7 @@ use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use RuntimeException; use RuntimeException;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
/** /**
* @ORM\Entity * @ORM\Entity
@ -88,6 +89,7 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
* @Serializer\Groups({"read"}) * @Serializer\Groups({"read"})
* @Serializer\Groups({"write"}) * @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"}) * @Serializer\Groups({"accompanying_period_work_evaluation:create"})
* @Assert\Valid
*/ */
private ?StoredObject $storedObject = null; private ?StoredObject $storedObject = null;