mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
fixes person resources
This commit is contained in:
@@ -55,7 +55,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private $freeText;
|
||||
private ?string $freeText = null;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
@@ -204,6 +204,10 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
$this->setThirdParty(null);
|
||||
}
|
||||
|
||||
if ('' === $freeText) {
|
||||
$this->freeText = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -266,9 +270,8 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
*/
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
if (null === $this->person && null === $this->thirdParty && null === $this->freeText) {
|
||||
if (null === $this->person && null === $this->thirdParty && (null === $this->freeText || '' === $this->freeText)) {
|
||||
$context->buildViolation('You must associate at least one entity')
|
||||
->atPath('person')
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user