Open belka-ew opened 9 years ago
Ok, I see. There is already such "wrapper": SmartyEngine and I should use the SmartyEngine service instead of Smarty. $this->get('templating.engine.smarty')->getSmarty() should give the expected result.
Another thing about services: Can it be that parameters "smarty.class_file" and "smarty.cache_warmer.class" aren't in use and can be removed from smarty.xml?
If I don't use a file resource but render a template from the string, smarty creates template_c not in the var/cache/prod/smarty/template_c but in the current directory. Minimal example:
Running this will fail and will create template_c/ in the symfony root directory. Running similar code from the controller will create template_c/ in the web/ directory (so web/template_c).
What is the problem? 'compile_dir' is set in NoiseLabs\Bundle\SmartyBundle\DependencyInjection\Configuration and it happens in the constructor of NoiseLabs\Bundle\SmartyEngine. So if I call $this->get('smarty') before $this->render(...) in controller I get unconfigured smarty instance. My suggestion would be to create a smarty service around the \Smarty and set smarty configuration inside of this service. If this solution is acceptable I can create a pull request.