8000 php templating engine service is inaccessible (set to private) · Issue #7254 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

php templating engine service is inaccessible (set to private) #7254

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

Closed
ghost opened this issue Mar 3, 2013 · 7 comments
Closed

php templating engine service is inaccessible (set to private) #7254

ghost opened this issue Mar 3, 2013 · 7 comments
Labels
Good first issue Ideal for your first contribution! (some Symfony experience may be required) Templating

Comments

@ghost
Copy link
ghost commented Mar 3, 2013

Can we change the service to public? If so, would that be considered a bug
fix or a new feature?

@stof
Copy link
Member
stof commented Mar 4, 2013

Why would you need to access this service ? You can use the templating service (which will be the DelegatingEngine when you enable several templating engine or the only engine you have when a single one is enabled)

@ghost
Copy link
Author
ghost commented Mar 4, 2013

because addGlobals (and many other methods) aren't available on the delegating engine nor can i grab the php engine directly because getEngine is protected.

@stof
Copy link
Member
stof commented Mar 4, 2013

If you want to add some globals, you should use a compiler pass to add a method call on the service definition instead of getting the service somewhere during the boot process or the kernel events. This way, this keeps the service lazy-loaded and ensures that your global is always set when using the service.

@ghost
Copy link
Author
ghost commented Mar 4, 2013

i saw that the twig engine was available as a public service, so i suggested the same for the php engine. is there a reason for that?

@ghost
Copy link
Author
ghost commented Mar 4, 2013

perhaps the real problem is that the constructor of the PHPEngine should be more flexible and not just force a single global. I wonder if there are any other folks who are interested in the phpengine who have any ideas on that? It seems to be somewhat illmaintained comparatively.

@ghost
Copy link
Author
ghost commented Mar 4, 2013

oh BTW.. i cannot simply set globals at compile time, some of them are based on the request. So a compiler pass will not solve (all) my problems.

@fabpot
Copy link
Member
fabpot commented Jun 13, 2013

Moving DelegatingEngine::getEngine() to public seems reasonable to me.

fabpot added a commit that referenced this issue Jun 17, 2013
This PR was merged into the master branch.

Discussion
----------

[Templating|FrameworkBundle] Made DelegatingEngine::getEngine() public

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #7254
| License       | MIT
| Doc PR        | -

As a bonus I've covered both classes with tests.

Commits
-------

a54cbff [FrameworkBundle] Made DelegatingEngine::getEngine() public.
3f84cd3 [Templating] Made DelegatingEngine::getEngine() public.
0a72a99 [FrameworkBundle] Added tests for the DelegatingEngine.
6c31ab2 [Templating] Added tests for the DelegatingEngine.
@fabpot fabpot closed this as completed Jun 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Ideal for your first contribution! (some Symfony experience may be required) Templating
Projects
None yet
Development

No branches or pull requests

2 participants
0