I tried to use the FOSUserBundle, I followed the instructions on the documentation for overwriting the Bundle, but I get this error when I try to access to /register while /login works (I didn't overwrite it):
Could not load type "app_user_registration"
500 Internal Server Error - InvalidArgumentException
Configurations
Symfony version: 3.1.7
FOSUserBundle version: dev-master
My files
app/config/services.yml:
services:
app.form.registration:
class: CoreBundle\Form\Type\RegistrationFormType
tags:
- { name: form.type, alias: app_user_registration }
app/config/config.yml:
fos_user:
db_driver: orm
firewall_name: main
user_class: CoreBundle\Entity\User
registration:
form:
type: app_user_registration
src/CoreBundle/Form/Type/RegistrationFormType.php
<?php
// src/CoreBundle/Form/Type/RegistrationFormType.php
namespace CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class RegistrationFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name');
}
public function getParent()
{
return 'fos_user_registration';
}
public function getName()
{
return 'app_user_registration';
}
}
?>
src/viwa/UserBundle/Controller/RegistrationController.php:
<?php
// src/viwa/UserBundle/Controller/RegistrationController.php
namespace viwa\UserBundle\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use FOS\UserBundle\Controller\RegistrationController as BaseController;
class RegistrationController extends BaseController
{
// Don't need to change this right now.
}
?>
src/viwa/UserBundle/viwaUserBundle.php:
<?php
// src/viwa/UserBundle/viwaUserBundle.php
namespace viwa\UserBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class viwaUserBundle extends Bundle
{
public function getParent()
{
return 'FOSUserBundle';
}
}
If you need anything other to help me I edit my post.
Hope anyone can help me out.
Your config.yml file should be:
fos_user:
db_driver: orm
firewall_name: main
user_class: CoreBundle\Entity\User
registration:
form:
type: CoreBundle\Form\Type\RegistrationFormType
In your src/CoreBundle/Form/Type/RegistrationFormType.php
, getParent()
function should be:
public function getParent()
{
return 'FOS\UserBundle\Form\Type\RegistrationFormType';
}