-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from talis/event-hooks
90% implement event hooks
- Loading branch information
Showing
14 changed files
with
452 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: chrisc | ||
* Date: 05/08/2015 | ||
* Time: 13:36 | ||
*/ | ||
|
||
namespace Tripod; | ||
|
||
/** | ||
* Interface IEventHook | ||
* @package Tripod | ||
*/ | ||
interface IEventHook | ||
{ | ||
/** | ||
* Constant for save changes event. | ||
* IEventHook::pre() will be passed the following parameters in a multidimensional array: | ||
* - oldGraph - the graph state before the change | ||
* - newGraph - the graph state after the change is successfully applied | ||
* | ||
* IEventHook::pre() will be passed the following parameters in a multidimensional array: | ||
* - subjectsAndPredicatesOfChange - an array, keyed by subject, with the subjects and predicates changed during the save | ||
*/ | ||
const EVENT_SAVE_CHANGES = "EVENT_SAVE_CHANGES"; | ||
|
||
/** | ||
* This method gets called just before the event happens. The arguments passed depend on the event in question, see | ||
* the documentation for that event type for details | ||
* @param $args array of arguments | ||
*/ | ||
public function pre(array $args); | ||
|
||
/** | ||
* This method gets called after the event has successfully completed. The arguments passed depend on the event in | ||
* question, see the documentation for that event type for details | ||
* If the event throws an exception or fatal error, this method will not be called. | ||
* @param $args array of arguments | ||
*/ | ||
public function success(array $args); | ||
|
||
/** | ||
* This method gets called if the event failed for any reason. The arguments passed should be the same as IEventHook::pre | ||
* @param array $args | ||
* @return mixed | ||
*/ | ||
public function failure(array $args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.