I created my own actionEntrySave
for my frontend form. and I'm using the
$entryService->saveEntry($entry);
method to store my entries into the database.
The problem is this does not fire
craft()->on('entries.onSaveEntry', function(Event $event) {
die(var_dump("fired"));
});
When I save/edit the same entry in the backend or create a new one I see an empty page with "fired" there.. (just for testing) and I can manipulate the entry the way I want without any problems. If I do the same in the frontend (saving/editing an entry) the event does not trigger but the entry saves. Can someone explain why?
Thank you very much
edit: I already tried onBeforeSaveEntry with the same result
Edit 2 Solved
I solved it now.. my error was I did this
$entryService = new EntriesService();
$dbInsert = $entryService->saveEntry($entry);
But it has to look like
$entryService = craft()->entries;
$dbInsert = $entryService->saveEntry($entry);
I thought all services were singletons. My mistake