Skip to content
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

[MailerBundle] Don't use deprecated Twig functionality #2530

Merged
merged 1 commit into from
Mar 3, 2015

Conversation

stloyd
Copy link
Contributor

@stloyd stloyd commented Mar 2, 2015

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
License MIT

if (null !== $email->getTemplate()) {
$data = $this->twig->mergeGlobals($data);

$template = $this->twig->loadTemplate($email->getTemplate());

$subject = $template->renderBlock('subject', $data);
Copy link
Contributor

Choose a reason for hiding this comment

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

The renderBlock method cannot be called because it is not in the API of Twig_TemplateInterface: http://twig.sensiolabs.org/api/master/Twig_TemplateInterface.html

Docblock says: This method is for internal use only and should never be directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not case for this PR IMO...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes but you replace deprecated features, it seems like the same ... not ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Problem with this is more complicated, that API is not deprecated, and yes it's internal, but unfortunately there is no real alternative to use (interface you pointed out is deprecated) so I guess it's acceptable to use it in current way till there will be official alternative.

@amenophis
Copy link
Contributor

Should I integrate this change in the following PR: #2482 ?

if (null !== $email->getTemplate()) {
$data = $this->twig->mergeGlobals($data);
Copy link
Contributor

Choose a reason for hiding this comment

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

$data is used in the else, so it is needed before !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not used in else as it's not same env...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes my bad !

@amenophis
Copy link
Contributor

i've done all your changes in my PR #2482

@stloyd
Copy link
Contributor Author

stloyd commented Mar 3, 2015

@pjedrzejewski @Arn0d ping ;)

pjedrzejewski pushed a commit that referenced this pull request Mar 3, 2015
[MailerBundle] Don't use deprecated Twig functionality
@pjedrzejewski pjedrzejewski merged commit 05449b3 into Sylius:master Mar 3, 2015
@pjedrzejewski
Copy link
Member

Thank you Joseph! 👍

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.

None yet

3 participants