[TYPO3-mvc] Where is the right place for methods like sendEmailAfterNewObjectIsSaved() in your extbase extension?

Roland most.wanted at gmx.at
Mon Jun 25 17:27:59 CEST 2012


okay,

finally i think iunderstand.

thanks for your help!

roland

ps: i guess i should add $newBeer to your $beerRepository! ;-)






Am 25.06.12 17:22, schrieb Bastian Waidelich:
> Roland wrote:
>
> Hi,
>
>> > Instead you could create a NotificationService
>>
>> i guess this should then implement t3lib_Singleton
>
> Yes, makes sense!
>
>> must be instantiated in my domain model object
>
> No. Usually sending notification emails is not part of your domain.
> Instead you could trigger it from your controller (but it should be a
> one-liner there). E.G.:
>
> $this->beerRepository->add($newBeer);
> $this->flashMessageContainer->add('Yummy, beer!');
> $this->notificationService->sendBeerNotification($newBeer);
>
> Or, if the notification service is just a thin wrapper like [1]:
> $this->notificationService->sendTemplateEmail($recipient, $sender, 'New
> Beer', 'BeerNotificationTemplate', array('beer' => $newBeer));
>
>> should it be instantiated via dependency injection?
>
>
> That doesn't really matter. But yes :)
>
> [1]
> http://forge.typo3.org/projects/typo3v4-mvc/wiki/How_to_use_the_Fluid_Standalone_view_to_render_template_based_emails
>
>
>



More information about the TYPO3-project-typo3v4mvc mailing list