Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Symfony][Symfony2][SF2]Nie mogę załadować przestrzeni nazw z pliku yml
amii
post 14.12.2013, 19:56:51
Post #1





Grupa: Zarejestrowani
Postów: 728
Pomógł: 76
Dołączył: 12.06.2009

Ostrzeżenie: (0%)
-----


Postępuje zgodnie z dokumentacją http://sonata-project.org/bundles/admin/ma...ng_started.html

Plik app/config/config.yml
  1. imports:
  2. - { resource: parameters.yml }
  3. - { resource: security.yml }
  4. - { resource: @PortalSlubnyMainBundle/Resources/config/admin.yml }


Plik: src/PortalSlubny/MainBundle/Resources/config/admin.yml
  1. sonata.admin.post:
  2. class: PortalSlubny\MainBundle\UserAdmin
  3. tags:
  4. - { name: sonata.admin, manager_type: orm, group: "Users", label: "Users" }
  5. arguments:
  6. - ~
  7. - PortalSlubny\MainBundle\Entity\User
  8. - ~
  9. calls:
  10. - [ setTranslationDomain, [PortalSlubny\MainBundle\Entity\User]]
  11. # - [null, PortalSlubny\MainBundle\Entity\User, SonataAdminBundle:CRUD]


Plik: src/PortalSlubny/MainBundle/DependencyInjection/PortalSlubnyMainExtension.php
  1. <?php
  2.  
  3. namespace PortalSlubny\MainBundle\DependencyInjection;
  4.  
  5. use Symfony\Component\DependencyInjection\ContainerBuilder;
  6. use Symfony\Component\Config\FileLocator;
  7. use Symfony\Component\HttpKernel\DependencyInjection\Extension;
  8. use Symfony\Component\DependencyInjection\Loader;
  9.  
  10. /**
  11.  * This is the class that loads and manages your bundle configuration
  12.  *
  13.  * To learn more see {@link <a href="http://symfony.com/doc/current/cookbook/bundles/extension.html}" target="_blank">http://symfony.com/doc/current/cookbook/bu...extension.html}</a>
  14.  */
  15. class PortalSlubnyMainExtension extends Extension
  16. {
  17. /**
  18.   * {@inheritDoc}
  19.   */
  20. public function load(array $configs, ContainerBuilder $container)
  21. {
  22. $configuration = new Configuration();
  23. $config = $this->processConfiguration($configuration, $configs);
  24.  
  25. $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
  26. $loader->load('services.yml');
  27. $loader->load('admin.yml'); //dopisane w/g dokumntacji
  28. }
  29. }
[xml][/xml]

Efekt jest taki, że przy próbie oczyszczenia cache komendą: php app/console cache:clear --env=prod --no-debug
dostaje info o błędzie:
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot import resource "/home/piotr/public_html/slub/src/PortalSlubny/MainB
undle/Resources/config/admin.yml" from "/home/piotr/public_html/slub/app/co
nfig/config.yml". (There is no extension able to load the configuration for
"sonata.admin.post" (in /home/piotr/public_html/slub/src/PortalSlubny/Main
Bundle/Resources/config/admin.yml). Looked for namespace "sonata.admin.post
", found "framework", "security", "twig", "monolog", "swiftmailer", "asseti
c", "doctrine", "sensio_framework_extra", "portal_slubny_main", "fos_user",
"sonata_core", "sonata_block", "knp_menu", "sonata_doctrine_orm_admin", "s
onata_admin")


--------------------
gry flash online
Dobry hosting i tanie odnowienia domen firma: masternet.
Zarabianie bez wysiłku na domenach bez ruchu: prolink.
Go to the top of the page
+Quote Post
destroyerr
post 14.12.2013, 21:21:35
Post #2





Grupa: Zarejestrowani
Postów: 879
Pomógł: 189
Dołączył: 14.06.2006
Skąd: Bytom

Ostrzeżenie: (0%)
-----


sonata.admin.post to id usługi, a skoro usługa to powinna być pod kluczem services w pliku src/PortalSlubny/MainBundle/Resources/config/admin.yml.

Poza tym albo ładujesz ten plik z głównego pliku konfiguracyjnego, albo w rozszerzeniu. Ładowanie w obu miejscach nie ma sensu.

Ten post edytował destroyerr 14.12.2013, 21:23:17
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.03.2024 - 13:36