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:
2022-04-27 07:01:06 +00:00
4 changed files with 18 additions and 10 deletions

View File

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

View File

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

View File

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