Hi,

Thanks for trying to help, I did look at the manual. If I create an emailer
service as an EventSubcriber, then:

$eventManager = new EventManager();
$eventManager->addEventSubscriber(new MailerSubscriber($params));
$entityManager = EntityManager::create($dbOpts, $config, $eventManager);

Then in my entity listener class, all methods of MailerSubscriber() class
will be available as $eventArgs->someMethodsOfMailerSubscriber() ? or there
is a particular method to get MailerSubscriber instance or methods insider
an entity listener class?

in entity class I use:
$metadata->addEntityListener('prePersist', 'SomeEntityListener',
'prePersistHandler');

then in listener class:

class SomeEntityListener
{
   public function prePersistHandler(Something $something,
LifecycleEventArgs $eventArgs)
    {
          $blah = $eventArgs->someMethodsOfMailerSubscriber() ??
    }
}

or what to do? I am confused. please clarify.


On Thu, Aug 13, 2015 at 5:42 PM, Marco Pivetta <[email protected]> wrote:

> You'd pass it to an event subscriber, not to an event listener. An event
> subscriber can be built as a service, and can have dependencies.
>
> See http://doctrine-orm.readthedocs.org/en/latest/reference/events.html
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
>
> On 13 August 2015 at 14:10, Nima Sadjadi <[email protected]> wrote:
>
>> Is it possible or not possible?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "doctrine-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/doctrine-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to