Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [SF][Symfony2][Symfony]fosuserbundle błąd podczas tworzenia użytkownika
Forum PHP.pl > Forum > PHP > Frameworki
symer
Witam. Otóż mam problem z utworzeniem użytkownika za pomocą fosuserbundle:
  1. C:\xampp\htdocs\symfony2\szypi>php app/console fos:user:create adnim szypula89@o
  2. net.pl haker777
  3. PHP Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exce
  4. ption\InvalidArgumentException' with message 'There is no extension able to load
  5. the configuration for "encoders" (in C:\xampp\htdocs\symfony2\szypi\app/config\
  6. security.yml). Looked for namespace "encoders", found "framework", "security", "
  7. twig", "monolog", "swiftmailer", "doctrine", "sensio_framework_extra", "fos_user
  8. ", "debug", "web_profiler", "sensio_distribution"' in C:\xampp\htdocs\symfony2\s
  9. zypi\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Loader\Yam
  10. lFileLoader.php:399
  11. Stack trace:
  12. #0 C:\xampp\htdocs\symfony2\szypi\vendor\symfony\symfony\src\Symfony\Component\D
  13. ependencyInjection\Loader\YamlFileLoader.php(369): Symfony\Component\DependencyI
  14. njection\Loader\YamlFileLoader->validate(Array, 'C:\\xampp\\htdocs...')
  15. #1 C:\xampp\htdocs\symfony2\szypi\vendor\symfony\symfony\src\Symfony\Component\D
  16. ependencyInjection\Loader\YamlFileLoader.php(44): Symfony\Component\DependencyIn
  17. jection\Loader\YamlFileLoader->loadFile('C:\\xampp\\htdoc in C:\xampp\htdocs\sym
  18. fony2\szypi\vendor\symfony\symfony\src\Symfony\Component\Config\Loader\FileLoade
  19. r.php on line 133
  20.  
  21. Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception
  22. \InvalidArgumentException' with message 'There is no extension able to load the
  23. configuration for "encoders" (in C:\xampp\htdocs\symfony2\szypi\app/config\secur
  24. ity.yml). Looked for namespace "encoders", found "framework", "security", "twig"
  25. , "monolog", "swiftmailer", "doctrine", "sensio_framework_extra", "fos_user", "d
  26. ebug", "web_profiler", "sensio_distribution"' in C:\xampp\htdocs\symfony2\szypi\
  27. vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Loader\YamlFile
  28. Loader.php:399
  29. Stack trace:
  30. #0 C:\xampp\htdocs\symfony2\szypi\vendor\symfony\symfony\src\Symfony\Component\D
  31. ependencyInjection\Loader\YamlFileLoader.php(369): Symfony\Component\DependencyI
  32. njection\Loader\YamlFileLoader->validate(Array, 'C:\\xampp\\htdocs...')
  33. #1 C:\xampp\htdocs\symfony2\szypi\vendor\symfony\symfony\src\Symfony\Component\D
  34. ependencyInjection\Loader\YamlFileLoader.php(44): Symfony\Component\DependencyIn
  35. jection\Loader\YamlFileLoader->loadFile('C:\\xampp\\htdoc in C:\xampp\htdocs\sym
  36. fony2\szypi\vendor\symfony\symfony\src\Symfony\Component\Config\Loader\FileLoade
  37. r.php on line 133


oto plik security.yml:
  1. imports:
  2. - { resource: parameters.yml }
  3. - { resource: security.yml }
  4. - { resource: services.yml }
  5. - { resource: "@SzypiBundle/Resources/config/services.yml" }
  6.  
  7. # Put parameters here that don't need to change on each machine where the app is deployed
  8. # <a href="http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration" target="_blank">http://symfony.com/doc/current/best_practi...d-configuration</a>
  9. parameters:
  10. locale: en
  11.  
  12. framework:
  13. #esi: ~
  14. #translator: { fallbacks: ["%locale%"] }
  15. secret: "%secret%"
  16. router:
  17. resource: "%kernel.root_dir%/config/routing.yml"
  18. strict_requirements: ~
  19. form: ~
  20. csrf_protection: ~
  21. validation: { enable_annotations: true }
  22. #serializer: { enable_annotations: true }
  23. templating:
  24. engines: ['twig']
  25. default_locale: "%locale%"
  26. trusted_hosts: ~
  27. trusted_proxies: ~
  28. session:
  29. # handler_id set to null will use default session handler from php.ini
  30. handler_id: ~
  31. fragments: ~
  32. http_method_override: true
  33. translator: ~
  34. session:
  35. default_locale: pl
  36.  
  37. # Twig Configuration
  38. twig:
  39. debug: "%kernel.debug%"
  40. strict_variables: "%kernel.debug%"
  41.  
  42. # Doctrine Configuration
  43. doctrine:
  44. dbal:
  45. driver: pdo_mysql
  46. host: "%database_host%"
  47. port: "%database_port%"
  48. dbname: "%database_name%"
  49. user: "%database_user%"
  50. password: "%database_password%"
  51. charset: UTF8
  52. # if using pdo_sqlite as your database driver:
  53. # 1. add the path in parameters.yml
  54. # e.g. database_path: "%kernel.root_dir%/data/data.db3"
  55. # 2. Uncomment database_path in parameters.yml.dist
  56. # 3. Uncomment next line:
  57. # path: "%database_path%"
  58.  
  59. orm:
  60. auto_generate_proxy_classes: "%kernel.debug%"
  61. naming_strategy: doctrine.orm.naming_strategy.underscore
  62. auto_mapping: true
  63.  
  64. # Swiftmailer Configuration
  65. swiftmailer:
  66. transport: "%mailer_transport%"
  67. host: "%mailer_host%"
  68. username: "%mailer_user%"
  69. password: "%mailer_password%"
  70. spool: { type: memory }
  71. fos_user:
  72. db_driver: orm
  73. firewall_name: main
  74. user_class: SzypiBundle\Entity\User


plik user w ENTITY:
  1. <?php
  2. namespace SzypiBundle\Entity;
  3. &#8203;
  4. use FOS\UserBundle\Model\User as BaseUser;
  5. use Doctrine\ORM\Mapping as ORM;
  6. &#8203;
  7. /**
  8. * @ORM\Entity
  9. * @ORM\Table(name="fos_user")
  10. */
  11. class User extends BaseUser
  12. {
  13. /**
  14.   * @ORM\Id
  15.   * @ORM\Column(type="integer")
  16.   * @ORM\GeneratedValue(strategy="AUTO")
  17.   */
  18. protected $id;
  19. &#8203;
  20. public function __construct()
  21. {
  22. parent::__construct();
  23. // your own logic
  24. }
  25. &#8203;
  26. }


gdzie może być błąd? proszę o pomoc
prz3kus
Ładnie tak podawać wszystkim swoje hasło z forum smile.gif questionmark.gif
kpt_lucek
No a gdzie ten plik security.yml? Dałeś config.yml
symer
config.yml
  1. imports:
  2. - { resource: parameters.yml }
  3. - { resource: security.yml }
  4. - { resource: services.yml }
  5. - { resource: "@SzypiBundle/Resources/config/services.yml" }
  6.  
  7. # Put parameters here that don't need to change on each machine where the app is deployed
  8. # <a href="http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration" target="_blank">http://symfony.com/doc/current/best_practi...d-configuration</a>
  9. parameters:
  10. locale: en
  11.  
  12. framework:
  13. #esi: ~
  14. #translator: { fallbacks: ["%locale%"] }
  15. secret: "%secret%"
  16. router:
  17. resource: "%kernel.root_dir%/config/routing.yml"
  18. strict_requirements: ~
  19. form: ~
  20. csrf_protection: ~
  21. validation: { enable_annotations: true }
  22. #serializer: { enable_annotations: true }
  23. templating:
  24. engines: ['twig']
  25. default_locale: "%locale%"
  26. trusted_hosts: ~
  27. trusted_proxies: ~
  28. session:
  29. # handler_id set to null will use default session handler from php.ini
  30. handler_id: ~
  31. fragments: ~
  32. http_method_override: true
  33. translator: ~
  34. session:
  35. default_locale: pl
  36.  
  37. # Twig Configuration
  38. twig:
  39. debug: "%kernel.debug%"
  40. strict_variables: "%kernel.debug%"
  41.  
  42. # Doctrine Configuration
  43. doctrine:
  44. dbal:
  45. driver: pdo_mysql
  46. host: "%database_host%"
  47. port: "%database_port%"
  48. dbname: "%database_name%"
  49. user: "%database_user%"
  50. password: "%database_password%"
  51. charset: UTF8
  52. # if using pdo_sqlite as your database driver:
  53. # 1. add the path in parameters.yml
  54. # e.g. database_path: "%kernel.root_dir%/data/data.db3"
  55. # 2. Uncomment database_path in parameters.yml.dist
  56. # 3. Uncomment next line:
  57. # path: "%database_path%"
  58.  
  59. orm:
  60. auto_generate_proxy_classes: "%kernel.debug%"
  61. naming_strategy: doctrine.orm.naming_strategy.underscore
  62. auto_mapping: true
  63.  
  64. # Swiftmailer Configuration
  65. swiftmailer:
  66. transport: "%mailer_transport%"
  67. host: "%mailer_host%"
  68. username: "%mailer_user%"
  69. password: "%mailer_password%"
  70. spool: { type: memory }
  71. fos_user:
  72. db_driver: orm
  73. firewall_name: main
  74. user_class: SzypiBundle\Entity\User
Pilsener
Próbujesz użyć wartości, której nie zdefiniowałeś w konfiguracji. Tutaj opis tej akurat sekcji:
https://symfony.com/doc/current/security.html
Jednak
Cytat
za pomocą fosuserbundle:
paczka, której używasz może wymagać zupełnie innej konfiguracji, szukaj w dokumentacji paczki:
http://symfony.com/doc/master/bundles/FOSU...ndle/index.html

Trzeba czytać dokumentację, bo zazwyczaj nie wystarczy dodać paczki, trzeba ją jeszcze skonfigurować.
symer
orientujesz się, która to jest wartość? Ja z ksiażki to konfiguruje " Symfony2 włodziemierz gajda"

konfigurowałem to ale nadal nic...nie wiem może wersja jest nie taka i nie odpowiada wersji symfony2
kpt_lucek
Pokaż security.yml...
mzdybel
Nie brakuje Ci czegoś takiego?

  1. security.yml
  2. # To get started with security, check out the documentation:
  3. # <a href="https://symfony.com/doc/current/security.html" target="_blank">https://symfony.com/doc/current/security.html</a>
  4. security:
  5.  
  6. # <a href="https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded" target="_blank">https://symfony.com/doc/current/security.ht...sers-are-loaded</a>
  7. # providers:
  8. # in_memory:
  9. # memory: ~
  10.  
  11. providers:
  12. fos_userbundle:
  13. id: fos_user.user_provider.username
  14.  
  15. encoders:
  16. FOS\UserBundle\Model\UserInterface: bcrypt

symer
To jest ten plik security
  1. # To get started with security, check out the documentation:
  2. security:
  3. providers:
  4. fos_userbundle:
  5. id: fos_user.user_manager
  6.  
  7. encoders:
  8. FOS\UserBundle\Model\UserInterface: bcrypt
  9.  
  10. firewalls:
  11. main:
  12. pattern: ^/
  13. logout: true
  14. anonymous: true
  15. form_login:
  16. provider: fos_userbundle
  17. csrf_provider: form.csrf_provider
  18.  
  19. login_path: /login
  20. use_forward: false
  21. check_path: /login_check
  22. post_only: true
  23.  
  24. always_use_default_target_path: false
  25. default_target_path: /
  26. target_path_parameter: _target_path
  27. use_referer: false
  28.  
  29. failure_path: null
  30. failure_forward: false
  31.  
  32. username_parameter: _username
  33. password_parameter: _password
  34.  
  35. csrf_parameter: _csrf_token
  36. intention: authenticate
  37. access_control:
  38. - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
  39. - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
  40. - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
  41. - { path: ^/admin/, role: ROLE_ADMIN }
  42.  
  43. role_hierarchy:
  44. ROLE_ADMIN: ROLE_USER
  45. ROLE_SUPER_ADMIN: ROLE_ADMIN


na jakiej wersji działa w ogóle ten fosuserbundle? bo wydaje mi sie, że tutaj leży problem?


temat. zamknięty . problem rozwiązany. jest z wersjami. chodzi o wersje .
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.