나만의 FacebookBundle을 만들고
이 오류가 발생했습니다 :
There is no extension able to load the configuration for "facebookbundle" (in /facebookx/app/config/config_dev.yml). Looked for namespace "facebookbundle", found "framework", "security", "twig", "monolog", "swiftmailer", "assetic", "doctrine", "sensio_framework_extra", "jms_aop", "jms_di_extra", "jms_security_extra", "d_facebook", "d_user", "d_security", "web_profiler", "sensio_distribution"
오류 메시지는 내 config.yml에 "facebookbundle"이라는 항목이 있는데 이는 확장명으로 사용되지 않습니까?
내 config.yml
facebookbundle:
file: %kernel.root_dir%/../src/FacebookBundle/Facebook/FacebookInit.php
alias: facebook
app_id: xxx
secret: xxx
cookie: true
permissions: [email, user_birthday, user_location, user_about_me]
내 DFacebookExtension
<?php
namespace D\FacebookBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class DFacebookExtension 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');
foreach (array('app_id', 'secret', 'cookie', 'permissions') as $attribute) {
$container->setParameter('facebookbundle.'.$attribute, $config[$attribute]);
}
if (isset($config['file']) && $container->hasDefinition('acebookbundle.api')) {
$facebookApi = $container->getDefinition('facebookbundle.api');
$facebookApi->setFile($config['file']);
}
}
}
에러가 있었습니까?
- 답변 # 1
- 답변 # 2
또한구성 파일의 루트 키는 번들 이름의 정규화 된 형식이어야합니다.
이것은 몇 번 격려해 왔으며, 모르는 경우 해결하는 것이 매우 실망 스럽습니다.
예 : 번들이
MyFirstAwesomeBundle
인 경우 파일의 루트 키는my_first_awesome
여야합니다. . 따라서 낙타 케이스는 뱀 케이스로 변환되며 "번들"이라는 단어는 무시되거나 제거됩니다.따라서 파일의 루트 키를
Configuration::getConfigTreeBuilder()
에 지정된 값과 정확히 일치시키는 것 충분하지 않습니다.이 규칙을 따르지 않으면
<시간>There is no extension able to load the configuration
를 얻게됩니다 오류.이 페이지로 끝나는 다음 절망적 인 영혼을 도울 수 있기를 바랍니다 ...
- 답변 # 3
app/AppKernel.php에서 번들을 시작하는 것을 잊었을 때 발생합니다 :
<?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { public function registerBundles() { $bundles = array ( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Symfony\Bundle\DoctrineBundle\DoctrineBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), //... new D\FacebookBundle\DFacebookBundle(), //... ); if (in_array($this->getEnvironment(), array ('dev', 'test'))) { $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); } return $bundles; } public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml'); } }
- 답변 # 4
이 오류는
services
가 없거나 잘못되어 발생할 수도 있습니다 설정의 루트에 키. 다음과 같이 보일 것입니다 :services: foo_bar.baz: class: Foo\BarBundle\Service\BazService
관련 자료
- c# - Dependency Injection과 Extension 메서드가 상호 작용하는 방법이 있습니까?
- c++ - 에 "h"확장자가있는 이유
- html - CSS 속성 값을 미리보고 VSCode에서 그 중 하나를 선택하는 바로 가기 또는 확장이 있습니까?
- 셀레늄 인스턴스 (Python)에서 확장 설정을 유지하는 방법이 있습니까?
- eclipse - 새 마법사 프로젝트를 만들기 위해 프로젝트 탐색기에 확장을 추가하는 방법이 있습니까?
- amazon lex - "예"또는"예"와 같이 발언을 수락하려는 확인을 위해 AWS에 필요한 구성이 있습니까?
- 여러 캐싱에서 하나의 Hazelcast 구성을 사용하는 방법이 있습니까?
- OpenCv의 폴더에서 여러 이미지 읽기 (python)
- 파이썬 셀레늄 모든 "href"속성 가져 오기
- html - 자바 스크립트 - 클릭 후 변경 버튼 텍스트 변경
- javascript - 현재 URL에서 특정 div 만 새로 고침/새로 고침
- JSP에 대한 클래스를 컴파일 할 수 없습니다
- JavaScript 변수를 HTML div에 '출력'하는 방법
- git commit - 자식 - 로컬 커밋 된 파일에 대한 변경을 취소하는 방법
- jquery - JavaScript로 현재 세션 값을 얻으시겠습니까?
- javascript - swiperjs에서 정지, 재생 버튼 추가
- python - 화면에서 찾은 요소를 찾을 수없는 경우 셀레늄
맞춤 설정 매개 변수를 승인하려면 번들 내의 Configuration.php 클래스를 사용하여 번들 구성을 정의해야합니다.
src/FacebookBundle/DependencyInjection/Configuration.php :