Hello All,
This is just my 2nd day with Symfony and have tried out a few cookbook examples with my own modifications etc working fine. So I believe I have installed Symfony 2 (2.0.15) just right.
Decided to get FOSUserBundle installed and installed it manually as I do not have git on my windows m/c and my attempt to run the reinstall console command ended up wiping out my other bundles. My mistake - should have checked what the script was gonna do.
Anyway - did a re-install and a manual install of FOSUserBundle. Got portions of it working after a lot of configuration changes etc. I have my /user/login page display the login form correctly and it does seem to do a validation of the credentials with the login_check just fine (I do not have any entry in the DB yet). However, when I try any of the other paths (ex: /user/register), I get different errors (Either a "No route found for "GET /user/register"" or a "Could not load type "fos_user_registration_form" " based on the configuration files.
"No route found for "GET /user/register""
I get this error when this is how the configuration files look:
#Symfony/app/config/config.yml has these entries:
fos_user:
db_driver: orm
firewall_name: main
user_class: Acme\UserBundle\Entity\User
#Symfony/app/config/security.yml looks like below:
# app/config/security.yml
security:
providers:
in_memory:
users:
user: { password: userpass, roles: [ 'ROLE_USER' ] }
admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
fos_userbundle:
id: fos_user.user_manager
encoders:
Symfony\Component\Security\Core\User\User: plaintext
FOS\UserBundle\Model\UserInterface: sha512
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
pattern: ^/demo/secured/login$
security: false
secured_area:
pattern: ^/demo/secured/
form_login:
check_path: /demo/secured/login_check
login_path: /demo/secured/login
logout:
path: /demo/secured/logout
target: /demo/
#anonymous: ~
#http_basic:
# realm: "Secured Demo Area"
main:
pattern: ^/user/
form_login:
provider: fos_userbundle
login_path: fos_user_security_login
check_path: fos_user_security_check
csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
#- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
#- { path: ^/_internal, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
- { path: ^/user/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/user/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/user/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/user/profile/, role: ROLE_USER }
- { path: ^/user/admin/, role: ROLE_ADMIN }
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
#Symfony/app/config/routing.yml looks like below:
AcmeUserBundle:
resource: "@AcmeUserBundle/Resources/config/routing.yml"
prefix: /user
#Symfony/src/Acme/UserBundle/Resources/config/routing.yml looks like below:
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
With these configurations, I get /user/login and /user/login_check seemingly working fine. I haven't had a chance to check with correct credentials though. However, a /user/register gives me the "No route found for "GET /user/register" " as noted above.
So I decided to play around with the configuration files and add what felt like a route for /user/register as noted below:
Could not load type "fos_user_registration_form"
Symfony/app/config/routing.yml (modified)
AcmeUserBundle:
resource: "@AcmeUserBundle/Resources/config/routing.yml"
prefix: /user
resource: "@FOSUserBundle/Resources/config/routing/registration.xml" #added this line
prefix: /user/register #added this line
And tried /user/register again. This time I get the "Could not load type "fos_user_registration_form" " error. I have spent considerable time and looked around for answers - but unable to figure out what might be wrong.
There were some references to deps and deps.lock file but I believe these are used for automated install of the bundle. Since I did it manually, I am assuming I need not change these. I did the changes to autoloader and AppKernel.php manually as well.
Could someone please tell me what I could be doing wrong?
Thanks,
Ryan
