-
-
Notifications
You must be signed in to change notification settings - Fork 399
Open
Labels
DocumentationImprovements or additions to documentationImprovements or additions to documentationLiveComponentStatus: Needs ReviewNeeds to be reviewedNeeds to be reviewed
Description
Hi team!
I'm trying to validate a property of some LiveComponent that doesn't use a Symfony Form. I'm following this: https://symfony.com/bundles/ux-live-component/current/index.html#validation-without-a-form
My code is like this:
#[AsLiveComponent]
class MyComponent
{
use DefaultActionTrait;
use ValidatableComponentTrait;
#[LiveProp(writable: true)]
#[Assert\Choice(choices: ['foo', 'bar'])]
public string $type;
// ...
}If I put this in my template, I expect to see an error, but I don't see anything. The LiveComponent renders normally, without validating the value of the $type property:
<twig:MyComponent type="aaaaa"/>Also, on the Symfony Docs, I don't understand the followin:
Be sure to add the IsValid attribute/annotation to any property
where you want the object on that property to also be validated.
The docs doesn't show any example using that IsValid attribute and I'm not sure where to find it. Thanks!
Metadata
Metadata
Assignees
Labels
DocumentationImprovements or additions to documentationImprovements or additions to documentationLiveComponentStatus: Needs ReviewNeeds to be reviewedNeeds to be reviewed