fosuserbundle

Symfony - Override ProfileForm - option 'class' not exists

跟風遠走 提交于 2020-01-07 02:58:05
问题 I trying to override FOSUserBundle edit form for profile, so I do somethink like this: config.yml fos_user: db_driver: orm firewall_name: main user_class: crmBundle\Entity\User profile: form: type: crmBundle\Form\ProfileFormType services.yml services: app.form.profile: class: crmBundle\Form\ProfileFormType tags: - { name: form.type, alias: crm_user_profile } ProfileFormType.php namespace crmBundle\Form; use FOS\UserBundle\Util\LegacyFormHelper; use Symfony\Component\Form\AbstractType; use

FOSUserBundle generate:entities does not work, Access level of fields too high

∥☆過路亽.° 提交于 2020-01-07 02:01:07
问题 I have a problem with FOSUserBundle after I configured DoctrineExtensions, with StofDoctrineExtensionsBundle. First of all, to install DoctrineExtensions I had to remove "auto_mapping: true" segment from app/config/config.yml file. I found that if auto_mapping is not active I have to include FOSUserBundle: ~ in default:mappings segment. But, when I try php app/console doctrine:schema:update --force or php app/console doctrine:generate:entities FOS I get: PHP Deprecated: Comments starting with

PrePersit current user

别等时光非礼了梦想. 提交于 2020-01-06 05:15:16
问题 [SETTINGS] Symfony 3.4 Logged user (FosUserBundle) Projet Entity (below) src/AppBundle/Entity/Projet.php class Projet { /** * @var int * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="titre", type="string", length=50) */ private $titre; /** * @var \DateTime * * @ORM\Column(name="creation", type="datetime") */ private $creation; /** * @var \DateTime * * @ORM\Column(name="modification", type=

Add roles field to FOSUserBundle group form

冷暖自知 提交于 2020-01-06 02:30:10
问题 When activating group( base on its documentation) in FOSUserBundle, the group roles are not embedded on edit and update form!I already override GroupFormType and GroupController but I can't pass roles from controller to form class. my question is how can I add roles to form to let administrator change or assign role to groups? 回答1: Solving my problem by adding the role field to override GroupController public function editAction(Request $request, $groupName) { ... /** @var $formFactory \FOS

Symfony & FOSUserBundle: 3 different profiles, depending on role

孤街浪徒 提交于 2020-01-04 02:43:05
问题 I've a User class # User - id - username - password - email and three different roles with different profile fields : # 1. Teacher - teachingSince - aboutMe - classes # 2. Pupil - class - parents - dateOfBirth - grade 3. Parent - children - phoneNumber In another post the PUGXMultiUserBundle was recommended. I'd like to use the FOSUserBundle to achieve that. Does anyone know how I can define different profiles by role? Thanks in advance! 回答1: There will be lots of ways to do this. Simplest

FOSUserBundle, symfony 2.1. How can I add a role to a user at registration?

删除回忆录丶 提交于 2020-01-01 19:16:45
问题 I'm sure this is a simple question but I can't quite see or find the correct way to do it. How do I add a role to a user when that user is created using the registration form? 回答1: Found it. I was on the right track :) Override the registration form handler. https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_forms.md Add $user->addRole('ROLE_MYROLE'); before parent::onSuccess() 来源: https://stackoverflow.com/questions/12398754/fosuserbundle-symfony-2-1-how

FOSFacebookBundle and FOSUserBundle

≯℡__Kan透↙ 提交于 2020-01-01 03:31:09
问题 I'm trying to setup FOSFacebookBundle and FOSUserBundle, so users can login with registered accounts or facebook accounts. Here relevant codes: config.yml: fos_user: db_driver: orm firewall_name: public user_class: Fam\DiaBundle\Entity\User from_email: address: info@famdia.com sender_name: Staff registration: confirmation: enabled: true fos_facebook: file: %kernel.root_dir%/../vendor/facebook/src/base_facebook.php alias: facebook app_id: 1234567890 secret: abcdefg1234567890 cookie: true

Symfony2 FOSUserBundle extending registration form causes duplicate email to validate

五迷三道 提交于 2019-12-30 11:21:13
问题 I have a custom registration form type defined like this: .... public function buildForm(FormBuilderInterface $builder, array $options) { parent::buildForm($builder, $options); $builder ->remove('username') ->add('firstName') ->add('lastName') ->add('hei', 'entity', array( 'class' => 'AcmeAcmeBundle:HigherEducationalInstitution', 'label' => 'Higher Educational Institution' )); } .... The custom controller works pretty much the same as the one in the FOSUserbundle and also checks for a valid

Symfony2 FOSUserBundle extending registration form causes duplicate email to validate

别说谁变了你拦得住时间么 提交于 2019-12-30 11:21:11
问题 I have a custom registration form type defined like this: .... public function buildForm(FormBuilderInterface $builder, array $options) { parent::buildForm($builder, $options); $builder ->remove('username') ->add('firstName') ->add('lastName') ->add('hei', 'entity', array( 'class' => 'AcmeAcmeBundle:HigherEducationalInstitution', 'label' => 'Higher Educational Institution' )); } .... The custom controller works pretty much the same as the one in the FOSUserbundle and also checks for a valid

Force a field to not be required

大兔子大兔子 提交于 2019-12-30 03:43:48
问题 I am using Symfony2 and FOSUserBundle. Just as detailed in the documentation, I have overridden and created a "name" property in the User entity. I do all necessary and finally get that field to be shown in the form view. The thing is: when I go form_widget(form.name) and the input html tag is generated, a required="required" property is generated within it. And that causes the engine to red the input when the field is not filled in. How do I do to tell the Symfony2 not to make that field