service - Registering Silex Providers Throwing Errors -
creating app in silex , trying take first few steps, 1 of setting services/providers.
i loading these using yaml file. have tried registering each individual docs e.g.
$this->register( new twigserviceprovider(),array() );
here current bootstrap file(loading services file):
<?php namespace app; use igorw\silex\configserviceprovider; use silex\application silex; use symfony\component\routing\route; use symfony\component\routing\routecollection; use symfony\component\httpfoundation\request; class bootstrap extends silex { public function __construct() { $this['debug'] = true; $this->registerdefaultparameters(); $this->registerdefaultservices(); $this->registerroutes(); } protected function registerdefaultparameters() { $paths = isset($this['base_path']) ? $this['base_path'] : array(); if (!isset($paths['base'])) { $paths['base'] = realpath(__dir__ . '/../'); } $defaults = array( 'config' => $paths['base'] . '/app/config', 'twig.path' => $paths['base'] . '/public/themes/base/templates' ); foreach ($defaults $key => $value) { if (!isset($paths[$key])) { $paths[$key] = $value; } } $this['paths'] = $paths; } protected function registerdefaultservices() { $this->register( new configserviceprovider($this['paths']['config'] . "/services.yml") ); foreach($this['services'] $servicename => $servicedata) { $this->register( new $servicedata['class'],(array_key_exists('parameters',$servicedata)) ? $servicedata['parameters'] : array() ); } } protected function registerroutes() { $this->register( new configserviceprovider($this['paths']['config'] . "/routes.yml") ); $collection = new routecollection(); foreach($this['routes'] $key => $value) { $collection->add( $key, new route( $value['path'], $value['defaults'], array(), array(), null, null, $value['methods'] )); } $this['routes'] = $collection; } }
my issue is:
with every provider receiving fatal errors like
fatal error: uncaught exception 'invalidargumentexception' message 'identifier "this_is_an_identifier" not defined.'
i'm receiving errors loading services file , manually. , different each provider e.g.
the error related twig provider is:
fatal error: uncaught exception 'invalidargumentexception' message 'identifier "request_error" not defined.'
another 1 relating monolog :
fatal error: uncaught exception 'invalidargumentexception' message 'identifier "dispatcher" not defined.
so every provider/service has wrong isn't case. question why continuously receiving these errors? can see im not doing wrong?
heres composer file in case it's version thing:
{ "name": "cranbri/cvcms", "description": "cranbri cv cms silex", "minimum-stability": "dev", "require": { "silex/silex": "1.2.2", "symfony/yaml": "2.6.1", "igorw/config-service-provider": "1.2.2" }, "autoload": { "psr-4":{ "app\\": "app/" } } }
this stopping development altogether if can give me details appreciated. cheers
i wasn't calling parent!!! therefore have none of values parent class did hence why many of $app variables not set , couldn't found
Comments
Post a Comment