-
-
Notifications
You must be signed in to change notification settings - Fork 356
[TwigComponent] props reflexion #1387
New issue
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
Comments
What would be the "rules" ? |
If you have: #[AsTwigComponent]
class UserCard
{
public string $user = null;
public string $language = 'fr';
} {% props size = 'md' %}
// content here
//Then you can access {{ size }} {{ language }} {{ user }} Do you see what I mean? |
I thought it already worked this way? I thought that, even if your component is NOT anonymous, if you have |
This is not the case, and you actually had this issue during your live coding at the SymfonyCon 😁 |
In your example can you mount your component with size ? I imagine yes ?
right ? How would you handle it PHP-side in your mount methods ? DOes it appear in the component Metadata ? In the Events then ? Maybe those answers are really simple... but if "not", i fear this add much complexity to a limited gain. I mean, declaring properties in two different places in not the most frequent thing we see right ? Do you have maybe a full example where that addition feel like a immediate DX improvment ? (side note: I still think we should have a more distinct usage / interface between pure static components and php ones :)) |
Wait.... @weaverryan is right :) I just added the "foo" as props in the template ![]() ![]() |
Is there something i missed there guys ? @weaverryan @WebMamba |
Hey! I want your though before to start working on something.
Today if you have a TwigComponent
#[AsTwigComponent] class Button { ... }
The props label defined in the template will not be taken in to account because the Button component is not an anonymous component.
What do you think about letting the ability to merge props defined into the template with props defined in the class.
If a conflict happen raise an error.
WDYT?
The text was updated successfully, but these errors were encountered: