fix entity not defined in afterDestroy hook
add tests for after hooks
Merge pull request #6 from danmactough/fix-bad-pr

Fix afterDestroy hook