We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello , I tried to use Constraints such as : length or NotBlank but it seems be ignored
AreaTranslation.php
/** * @ORM\Entity() */ class AreaTranslation extends AbstractTranslation { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") * @Groups({"Area_read","Area_write"}) */ private $id; /** * @ORM\ManyToOne(targetEntity="App\Entity\Area", inversedBy="translations") * @Assert\NotNull */ protected $translatable; /** * @ORM\Column(type="string", length=255) * @Assert\NotBlank() * @Assert\Length(max=1500) * @Groups({"Area_read","Area_write","translations"}) */ private $name; /** * @ORM\Column(type="string") * @Assert\NotBlank * @Assert\Language * @Groups({"Area_read","Area_write","translations"}) */ protected $locale; public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } }
The text was updated successfully, but these errors were encountered:
If you want to validate nested items, you must add the @Assert\Valid at the property level this way
@Assert\Valid
/** * @ORM\Entity() */ class Area extends AbstractTranslatable { /** * @Assert\Valid * @ORM\OneToMany(targetEntity="App\Entity\AreaTranslation", mappedBy="translatable", fetch="EXTRA_LAZY", indexBy="locale", cascade={"PERSIST"}, orphanRemoval=true) * @Groups({"your_custom_group_read", "your_custom_group_write", "translations"}) */ protected $translations; }
Reference: https://stackoverflow.com/a/60431468/12750122
Sorry, something went wrong.
No branches or pull requests
Hello ,
I tried to use Constraints such as : length or NotBlank
but it seems be ignored
AreaTranslation.php
The text was updated successfully, but these errors were encountered: