Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/07/2015, 03:58
Avatar de Dundee
Dundee
 
Fecha de Ingreso: junio-2002
Ubicación: El Médano
Mensajes: 1.310
Antigüedad: 21 años, 10 meses
Puntos: 8
Respuesta: atascado con los eventos y subscribers

Cita:
Iniciado por hhs Ver Mensaje
Ya veo cual es el problema, necesitas leer sobre el Dispatcher Component: http://symfony.com/doc/current/compo...nt-subscribers te explica que es un evento, subscriber y listener.
Esa mismos nombres se utilizan tambien para Doctrine pero implementan otras interfaces.
Ok gracias, esto me está aclarando bastante, la verdad que no dejo de sorprenderme con Symfony, y lo que me pregunto es porque no habré trabajado antes con este FW :).

De todas formas a medida que voy leyendo, hay cosas que no consigo entender de forma clara, por ejemplo:
Código:
use Symfony\Component\EventDispatcher\Event;

$dispatcher->addListener('foo.action', function (Event $event) {
    // will be executed when the foo.action event is dispatched
});
Once a listener is registered with the dispatcher, it waits until the event is notified. In the above example, when the foo.action event is dispatched, the dispatcher calls the AcmeListener::onFooAction method and passes the Event object as the single argument:

Código:
use Symfony\Component\EventDispatcher\Event;

class AcmeListener
{
    // ...

    public function onFooAction(Event $event)
    {
        // ... do something
    }
}
¿Dé dónde sale el método AcmeListener::onFooAction ?, ¿no sería solo fooaction ?
Un saludo
__________________
Videotutoriales de Drupal

Última edición por Dundee; 10/07/2015 a las 04:29