fosuserbundle

How can I assign default role to user in Symfony2

不想你离开。 提交于 2019-12-25 03:05:20
问题 I want to assign default role to user after he is registered. I have implemented FOSUserBundle extended by SonataUserBundle. Unfortunetly SonataUserBundle requires FOSUserBundle ~1.3 and event listeners are only since FOSUserBundle 2.0. Is there another way to solve this problem except eventListener or FOSUserBundle controller override ? Maybe some kind of option in yaml I have missed ? It seems quite standard problem but I am still new in symfony2... 回答1: You can overwrite the getRoles()

Property “groups” is not public in class “Backend\UsuariosBundle\Entity\Usuario”. Maybe you should create the method “setGroups()”?

£可爱£侵袭症+ 提交于 2019-12-25 02:38:24
问题 I have this problem and I can´t resolve it. I'm newbie in Symfony 2. I explain my problem. I have a Usuario class and Group class. I have overwritten the RegistrationForm to add group to users. This is my code <?php namespace Backend\UsuariosBundle\Form\Type; use Symfony\Component\Form\FormBuilderInterface; use FOS\UserBundle\Form\Type\RegistrationFormType as BaseType; class RegistrationFormType extends BaseType { public function buildForm(FormBuilderInterface $builder, array $options) { //

SonataUserBundle + FOSUserBundle Annotation Issue Doctrine Primary Key Error

扶醉桌前 提交于 2019-12-25 01:45:41
问题 Using Symfony 4.1, Sonata User Bundle 4.x, and FOSUserBundle 2.1.2. I am trying to override the table names for the User and Group tables. I therefore added annotations to the auto generated user and group classes: use Sonata\UserBundle\Entity\BaseGroup as BaseGroup; use Doctrine\ORM\Mapping as ORM; /** * This file has been generated by the SonataEasyExtendsBundle. * @ORM\Entity() * @ORM\Table(name="aegis_group") * @link https://sonata-project.org/easy-extends * References: * @link http://www

SonataUserBundle + FOSUserBundle - overriding controllers

僤鯓⒐⒋嵵緔 提交于 2019-12-24 23:22:52
问题 I'm using SonataUserBundle with FOSUserBundle. in AppKernel.php it looks like this: new FOS\UserBundle\FOSUserBundle(), new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'), new Application\Sonata\UserBundle\ApplicationSonataUserBundle(), Some controllers from SonataUserBundle are already overriden. Now I want to overridee FOSUserBundle ChangePasswordController. So I made: src/Application/FOS/UserBundle/Controller/ChangePasswordController.php src/Application/FOS/UserBundle

How can I correctly configure GD support for PHP? I am getting an error calling imagettfbbox()

主宰稳场 提交于 2019-12-24 23:06:38
问题 Using Symfony2.0 and Gregwar Captcha Bundle for Symfony 2.0 Operating System: Mac OS 10.10 (Yosemite) After having installed the CaptchaBundle following the instructions, the first time I use it, I get the following error: Fatal error: Call to undefined function Gregwar\CaptchaBundle\Generator\imagettfbbox() in /Users/pgbonino/Sites/preparatest/vendor/bundles/Gregwar/CaptchaBundle/Generator/CaptchaGenerator.php on line 176 My phpinfo informs this: <h2><a name="module_gd">gd</a></h2> <table

EmailConfirmation with FosUserBundle Does not work

我与影子孤独终老i 提交于 2019-12-24 21:19:11
问题 hello i have been trying to send an email Confirmation since 2 days without success with FOSUSERBUNDLE on symfony 3.4. I know this is a process FosUser makes automatically But i can't make it's work. this is in my framework.yaml fos_user: db_driver: orm firewall_name: main user_class: App\Entity\User registration: confirmation: enabled: true from_email: address: correo@algo.com sender_name: toFront service: mailer: fos_user.mailer.twig_swift and this is in my .env file MAILER_URL=smtp://s6

FOSUserBundle, global arguments / function before templating

冷暖自知 提交于 2019-12-24 17:53:17
问题 I'm a beginner with Symfony2, and FOSUserBundle, although I'm loving it so far. As of right now, I can override existing templates (such as layout.html.twig), to conform /login, /profile, etc, to the style of the rest of my site. However, prior to use FOSUserBundle, my twig got what links are in the navbar and other widgets from php controllers. So my twig knows nothing about having a home page link or accounts page, e.g. my base.html.twig loops through an array of various objects to render.

Symfony2 FOSUserBundle FOSUserEvents

断了今生、忘了曾经 提交于 2019-12-24 14:24:23
问题 I'm trying to do redirection after regiter like here, but my onRegistrationConfirm() Event function is not executed during the registration. My code is similar to that in answer. I just don't know is there is something more to do, to make my event working. I'm new to symfony, so it might be really easy. 回答1: OK...so I guess theere is no such thing as FOSUserEvents::REGISTRATION_CONFIRM, there is nothing about it here. But I found there REGISTRATION_SUCCESS event which is exectly what I was

“No identifier/primary key specified for Entity” - extends FOS User

雨燕双飞 提交于 2019-12-24 03:59:22
问题 I have UserBundle who extends FOSUserBundle, and entity User who extends FOS's User class. On my localhost work fine, but on hosting i've got error: Fatal error: Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'No identifier/primary key specified for Entity "WisJa\CoreBundle\Entity\User" sub class of "FOS\UserBundle\Model\User". Every Entity must have an identifier/primary key.' in... My User entity all code: <?php namespace WisJa\CoreBundle\Entity; use Doctrine\ORM

Success handler not working after Symfony2 login

笑着哭i 提交于 2019-12-24 03:43:14
问题 The goal is to do something after authentication success in Symfony2. In order to do that I have extended AuthenticationSuccessHandlerInterface creating a service for the form login in order to be its success handler. Here is the firewall in the security.yml file (where the success handler is declared): firewalls: main: pattern: ^/ form_login: check_path: fos_user_security_check provider: fos_userbundle csrf_provider: form.csrf_provider success_handler: foo_user.component.authentication