# Problem mit hooks

**URL:** https://forum.shopware.com/t/problem-mit-hooks/46324
**Category:** Programmierung
**Created:** [14. Juni 2017 um 08:13 UTC](https://forum.shopware.com/t/problem-mit-hooks/46324 "2017-06-14T08:13:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![janicevn](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@janicevn](https://forum.shopware.com/u/janicevn)
#### Post date: [14. Juni 2017 um 08:13 UTC](https://forum.shopware.com/t/problem-mit-hooks/46324/1 "2017-06-14T08:13:57Z")

</div>

**Hallo,**

**&nbsp;**

**Ich habe eine Frage in Bezug auf die folgenden Artikel:**

**[https://developers.shopware.com/blog/2015/06/09/understanding-the-shopware-hook-system/](https://developers.shopware.com/blog/2015/06/09/understanding-the-shopware-hook-system/)**

**[https://developers.shopware.com/developers-guide/event-guide/](https://developers.shopware.com/developers-guide/event-guide/)**

**&nbsp;**

**In shopware ist es möglich, Hooks für public and protected Functions für Controllers, Core Classes und Repositories zu cachen, allerdings habe ich Probleme, folgenden Event Hook zu cachen:**

**$this-\>subscribeEvent(**

```
**'Shopware\_Controllers\_Frontend\_Register :: saveRegisterAction :: after',&nbsp; &nbsp;&nbsp;**

```

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'onFrontendPostDispatch’**

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);**

**&nbsp;**

**Für den Class Name habe ich folgende Optionen ohne Erfolg versucht**

**\Shopware\Controllers\Frontend\Register**

**Shopware\Controllers\Frontend\Register**

**Enlight\_Controller\_Action\_PreDispatch\_Frontend\_Register**

**Register**

**&nbsp;'Shopware\_Controllers\_Frontend\_Register::saveRegister::before’**

**&nbsp;**

**Meine Funktion lautet:**

**&nbsp;**

**&nbsp;&nbsp;public function onFrontendPostDispatch(Enlight\_Hook\_HookArgs $arguments)**

**&nbsp;&nbsp;{**

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$basketID = $arguments-\>getReturn();**

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/\*\* @var \Enlight\_Controller\_Action $controller \*/**

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Shopware()-\>PluginLogger()-\>info(“override method”);**

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$string = “2012-06-13T09:34:09+0200”;**

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$dateTime = new DateTime($string);**

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$now = new DateTime();**

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$string = $now-\>format(‘Y-m-d’); &nbsp;&nbsp;&nbsp;// MySQL datetime format**

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Shopware()-\>PluginLogger()-\>info($string);**

**&nbsp;**

**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $basketID;**

**}**

**&nbsp;**

**&nbsp;**

**Ich bin relativ neu in Shopware unterwegs und wäre über jede Hilfe dankbar!**

**&nbsp;**

**Viele Grüße,**

**Nemanja**
