Skip to content

[Twig] allow ExposeInTemplate to be used on public component methods #326

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

Merged
merged 1 commit into from
May 31, 2022

Conversation

kbond
Copy link
Member

@kbond kbond commented May 27, 2022

Q A
Bug fix? no
New feature? yes
Tickets n/a
License MIT

$attribute = $attribute->newInstance();

/** @var ExposeInTemplate $attribute */
$name = $attribute->name ?? (str_starts_with($method->name, 'get') ? lcfirst(substr($method->name, 3)) : $method->name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be great if we could reuse the logic from Twig or PropertyAccessor or ApiPlatform to determine the right "name" to use... but I'm not aware of any way to do that.

@weaverryan
Copy link
Member

Thanks Kevin!

@weaverryan weaverryan merged commit fa94da0 into symfony:2.x May 31, 2022
@kbond kbond deleted the expose-methods branch May 31, 2022 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants