diff --git a/code/web/cron/updateCommunityEngagementMilestonesProgress.php b/code/web/cron/updateCommunityEngagementMilestonesProgress.php new file mode 100644 index 0000000000..f71e598ba4 --- /dev/null +++ b/code/web/cron/updateCommunityEngagementMilestonesProgress.php @@ -0,0 +1,4 @@ +getSerializedFieldNames(); $compressedFields = $this->getCompressedColumnNames(); + do_action('before_object_insert', get_object_vars($this)); + $properties = get_object_vars($this); $propertyNames = ''; $propertyValues = ''; @@ -408,6 +410,9 @@ public function insert($context = '') { } } + #Call hook for post insert here + do_action('after_object_insert', $this); + return $response; } diff --git a/code/web/sys/action-hooks.php b/code/web/sys/action-hooks.php new file mode 100644 index 0000000000..fce15601a5 --- /dev/null +++ b/code/web/sys/action-hooks.php @@ -0,0 +1,80 @@ +query("SELECT sourceId from {$tableName} WHERE sourceId = {$value['sourceId']}"); + if ($checkOuts->getNumResults() > 0) { + return; + } + + # Add entry to ce_milestone_goal_actions + +}); + +// Example of action hook +// add_action('after_object_insert', 'after_checkout_insert', function($value){ + +// $tableName = 'user_checkout'; + +// # Bail if not the table we want +// if($value->__table != $tableName) return; + +// # Bail if the newly created checkout already exists +// $checkOuts = new CheckOut(); +// $checkOuts->query("SELECT sourceId from {$tableName} WHERE sourceId = {$value->sourceId}"); +// if ($checkOuts->getNumResults() > 0) { +// return; +// } + + +// }); \ No newline at end of file