I configure a symfony 2.7 installation with the lasted sonata admin and sonata user bundles. My backend work well, also work /profile page, but I'm getting this error in /profile/edit-profile and /profile/edit-authentication :
Unable to find template "MopaBootstrapBundle:Form:fields.html.twig" in SonataUserBundle:ChangePassword:changePassword_content.html.twig at line 2.
this is my config.yml
fos_user:
...
profile:
form:
type: fos_user_profile
handler: fos_user.profile.form.handler.default
name: fos_user_profile_form
validation_groups: [Authentication]
sonata_user:
...
profile: # Profile Form (firstname, lastname, etc ...)
form:
type: sonata_user_profile
handler: sonata.user.profile.form.handler.default
name: sonata_user_profile_form
validation_groups: [Profile]
and some routes:
sonata_user_resetting:
resource: "#SonataUserBundle/Resources/config/routing/sonata_resetting_1.xml"
prefix: /resetting
sonata_user_profile:
resource: "#SonataUserBundle/Resources/config/routing/sonata_profile_1.xml"
prefix: /profile
sonata_user_change_password:
resource: "#SonataUserBundle/Resources/config/routing/sonata_change_password_1.xml"
prefix: /profile
Also look for that template mention in that twig file but I don't see it.
Any help will be apreciated.
Finally I find the solution installing mopa bootsrap bundle and configure it.
Related
I'm using annotations in my project but to redirects using routes.yaml
If exists routing (ex. /home name="home"} that redirect not working:
home-301:
path: /home
defaults:
_controller: FrameworkBundle:Redirect:urlRedirect
path: /new-home
permanent: true
I found solution but I thing it is no good practice:
cleared: config/routes/annotations.yaml
and appended to the end of the file config/routes.yaml:
controllers:
resource: ../../src/Controller/
type: annotation
how to do it right?
My solution:
all redirects put in: config/routers/redirects.yaml
and config/routes.yaml:
redirects:
resource: routes/redirects.yaml
annotations:
resource: routes/annotations.yaml
I need to add a requirement for my api route (only allow 3 mgn , user and adm) but i get the error:
MissingMandatoryParametersException
Some mandatory parameters are missing ("role") to generate a URL for route "api_doc".
here is my route:
api_platform:
resource: .
type: api_platform
prefix: /{role}/api
requirements:
role: "mng|adm|user"
should i install or set something?, thank you
already find a solution
if some person need it
api_platform:
resource: .
type: api_platform
prefix: /{app}/api
defaults:
app: take|mngr|drvr
requirements:
app: take|mngr|drvr
thank you
I dont use FOS
What is wrong? My links directs to "login" and "register" and I am getting this:
No route found for "GET /login/"
Also getting this for register
No route found for "GET /register/"
My debug:router looks like:
Entity and Controller are in UserBundle routing.yml:
Because You did pass this:
# app/config/routing.yml
fos_user:
resource: "#FOSUserBundle/Resources/config/routing/all.xml"
If you use 2 > version FOSUserBundle
# app/config/routing.yml
fos_user_security:
resource: "#FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "#FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "#FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "#FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "#FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
I would recommend you to read this documentation: https://symfony.com/doc/current/bundles/FOSUserBundle/index.html
It throws this error:
Unrecognized option "handler" under "fos_user.registration.form"
And the files are:
//services.yml
app.form.registration:
class: AppBundle\Form\AccomodationFrontSignUpType
tags:
- { name: form.type, alias: app_user_registration }
app.form.handler.registration:
class: AppBundle\Form\Handler\RegistrationFormHandler
arguments: ["#fos_user.registration.form", "#request", "#fos_user.user_manager", "#fos_user.mailer", "#fos_user.util.token_generator"]
scope: request
public: false
//config.yml
fos_user:
db_driver: orm
firewall_name: main
user_class: AppBundle\Entity\User
group:
group_class: AppBundle\Entity\Group
service:
mailer: swiftmailer.mailer.strato
from_email:
address: webmyhomepage#strato.com
sender_name: myHomepage
registration:
form:
handler: app.form.handler.registration
type: app_user_registration
confirmation:
template: FOSUserBundle:Registration:email.txt.twig
enabled: true
Any help is welcome, thanks
The error means that there is an invalid parameter in your config. The key handler in your config
-> handler: app.form.handler.registration
if you take a look inside the fos user bundle DependencyInjection folder, Configuration.php file, that option does not exist. so its invalid :).
There you can see witch options are available. In my current version of this bundle i have this options available under form: type, name, validation_groups.
Also you can see the default configuration for a bundle with:
php app/console debug:config FOSUserBundle
I'm working with Symfony2.3.4 and PHP5.6.3
This happens only when I AM LOGGED IN PROD ENV, while I'm not or when I'm in dev env(logged or not) nothing bad happens, I can go anywhere in my site(security is not implemented yet).
Has anyone run into this issue already? I really don't know what other info you'd need to help me, please feel free to yell back for extra info.
routing.yml
homepage:
pattern: /homepage/
defaults: { _controller: GCBundle:Default:homepage }
UserBundle:
resource: "#UserBundle/Resources/config/routing.yml"
prefix: /user/
GCBundle:
resource: "#GCBundle/Resources/config/routing.yml"
prefix: /gc/
ReportsBundle:
resource: "#ReportsBundle/Resources/config/routing.yml"
prefix: /reports/
routing_dev.yml
_wdt:
resource: "#WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "#WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
_configurator:
resource: "#SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix: /_configurator
_main:
resource: routing.yml
#AcmeDemoBundle routes (to be removed)
_acme_demo:
resource: "#AcmeDemoBundle/Resources/config/routing.yml"
thanks