Skip to content
Snippets Groups Projects
Commit 602f450b authored by Erik Hommel's avatar Erik Hommel
Browse files

added abstract api entity and action methods

parent 1b91a3d5
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,22 @@ abstract class CRM_Civirules_Action {
protected $action = array();
/**
* Method to get the api entity to process in this CiviRule action
*
* @access protected
* @abstract
*/
protected abstract function getApiEntity();
/**
* Method to get the api action to process in this CiviRule action
*
* @access protected
* @abstract
*/
protected abstract function getApiAction();
/**
* Method to set RuleActionData
*
......@@ -55,8 +71,8 @@ abstract class CRM_Civirules_Action {
* @access public
*/
public function processAction(CRM_Civirules_EventData_EventData $eventData) {
$entity = $this->action['api_entity'];
$action = $this->action['api_action'];
$entity = $this->getApiEntity();
$action = $this->getApiAction();
$params = $this->getActionParameters();
......
......@@ -50,4 +50,24 @@ class CRM_CivirulesActions_GroupContact extends CRM_Civirules_Action {
}
return '';
}
/**
* Method to set the api entity
*
* @return string
* @access protected
*/
protected function getApiEntity() {
return 'GroupContact';
}
/**
* Method to set the api action
*
* @return string
* @access protected
*/
protected function getApiAction() {
return 'create';
}
}
\ No newline at end of file
......@@ -48,4 +48,7 @@ class CRM_CivirulesConditions_FirstContribution extends CRM_Civirules_Condition
public function getExtraDataInputUrl($ruleConditionId) {
return FALSE;
}
public function requiredEntities() {
return array('Contribution');
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment