php - Services not loaded at Resources/config/services.yml, why? -
i'm running issue here , don't know why or failing, perhaps miss configuration or so, anyway, have code @ dependencyinjection\appextension.php
file:
use symfony\component\dependencyinjection\containerbuilder; use symfony\component\config\filelocator; use symfony\component\httpkernel\dependencyinjection\extension; use symfony\component\dependencyinjection\loader; class appextension extends extension { /** * {@inheritdoc} */ public function load(array $configs, containerbuilder $container) { $configuration = new configuration(); $config = $this->processconfiguration($configuration, $configs); $loader = new loader\yamlfileloader($container, new filelocator(__dir__.'/../resources/config')); $loader->load('services.yml'); } }
then @ resources/config/services.yml
have this:
services: pdone.twig.extension: class: groupdca\pdonebundle\extension\pdonetwigextension tags: - { name: twig.extension }
for reason isn't working. mean got error:
the filter "empty" not exist in pdonebundle::pdone.html.twig @ line 1
now if move services definition config/config.yml
got error instead:
compile error: cannot use isset() on result of expression (you can use "null !== expression" instead)
which makes me think bundle not going through dependecyinjection, missing here? why different errors?
1) did add bundle appkernel
?
2) not sure, think must follow naming convention of extension
class:
- bundle's root directory should contain
dependencyinjection
directory - within
dependencyinjection
,extension
class should named<bundle>extension
, without "bundle" suffix.pdooneextension
in case.
Comments
Post a Comment