Ver Mensaje Individual
  #3 (permalink)  
Antiguo 19/02/2013, 09:47
Luvelnet
 
Fecha de Ingreso: enero-2012
Mensajes: 64
Antigüedad: 12 años, 4 meses
Puntos: 0
Respuesta: Login Symfony2.1

El formulario es este:

Código:
<div class="form">
                {% if error %}
                    <div>{{ error.message }}</div>
                {% endif %}
                <form name="login" action="{{ path('login_check') }}" method="post">
                    <label for="username">Usuario:</label>
                    <input type="text" id="username" name="_username" value="{{ last_username }}" />

                    <label for="password">Contraseña:</label>
                    <input type="password" id="password" name="_password" />

                    <p class="submit"><a href="#" onclick="submitForm('login')"></a></p>
                    <span class="footer"><a href="#">¿No puedes acceder?</a></span>
                    <span class="footer"><a href="{{ path('users_new') }}">Registrate aquí</a></span>
                </form>                    
            </div>
Y el controlador este por si acaso:

Código:
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();
        $request = $this->getRequest();
        $session = $request->getSession();
        
        $entities = $em->getRepository('PortadaBundle:Notices')->findAll();
        
        $form = $this->createForm(new UsersType());
        
        // Check login authentication
        if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
                $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
        } else {
                $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
        }
        

        return $this->render('PortadaBundle:Notices:index.html.twig', array('entities' => $entities,
                                                                            'section'  => 'Portada',
                                                                            'form'     => $form->createView(),
                                                                            'last_username' => $session->get(SecurityContext::LAST_USERNAME),
                                                                            'error'         => $error
                                                                            ));
    }
El error que me da al configurar el FOSUserBundle es respecto a la entidad user cuando la exteniendo de la UserBase, el error exactamente es:

Fatal error: Access level to FOS\UserBundle\Entity\User::$username must be protected (as in class FOS\UserBundle\Model\User) or weaker in C:\xampp\htdocs\cosmonautas\vendor\friendsofsymfon y\user-bundle\FOS\UserBundle\Entity\User.php on line 17

Es una clase del propio Bundle...

Gracias por responder!!