Silex에 앱을 만들고 처음 몇 가지 단계 중 하나를 시도해보십시오. 그 중 하나는 내 서비스/제공자를 설정하는 것입니다.Silex Providers 등록 오류 던지기
현재 YAML 파일을 사용하여로드 중입니다. 나는 또한 예를 들면 docs 같이 각 개인을 등록하는 시도했다. 내가
같은 치명적인 오류를 수신하고 모든 공급자와Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Identifier "this_is_an_identifier" is not defined.'
:
<?php
namespace App;
use Igorw\Silex\ConfigServiceProvider;
use Silex\Application as 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 as $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'] as $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'] as $key => $value)
{
$collection->add($key, new Route(
$value['path'],
$value['defaults'],
array(),
array(),
null,
null,
$value['methods']
));
}
$this['routes'] = $collection;
}
}
내 문제가 있습니다 : 여기
$this->register(new TwigServiceProvider(),array());
는 (파일에서로드 서비스) 내 현재 부트 스트랩 파일입니다
서비스에서 파일을로드하는 중 오류가 발생했습니다. 예 :
나뭇 가지 제공자와 관련된 오류는 다음과 같습니다
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Identifier "request_error" is not defined.'
독백에 관한 또 다른 하나는 다음과 같습니다
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Identifier "dispatcher" is not defined.
그래서 모든 업체처럼/서비스가 분명하지 않다 잘못을 가지고 그 케이스. 그래서 내 질문에 왜 계속해서 이러한 오류가 발생합니까? 내가 무엇을 잘못 못 보는 것을 볼 수 있겠 어? 누군가가 나에게 훨씬 이해할 수있는 정보를 제공 할 수 있습니다, 그래서 만약
{
"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/"
}
}
}
이 전부 내 개발을 중지하고 있습니다 :
Heres는 내 작곡가 파일은 경우는 버전 것입니다. 환호