if (!empty($this->id)) {
if ($hook) {
$preEvent = new \Civi\Core\DAO\Event\PreUpdate($this);
- \Civi::service('dispatcher')->dispatch("civi.dao.preUpdate", $preEvent);
+ \Civi::dispatcher()->dispatch("civi.dao.preUpdate", $preEvent);
}
$result = $this->update();
if ($hook) {
$event = new \Civi\Core\DAO\Event\PostUpdate($this, $result);
- \Civi::service('dispatcher')->dispatch("civi.dao.postUpdate", $event);
+ \Civi::dispatcher()->dispatch("civi.dao.postUpdate", $event);
}
$this->clearDbColumnValueCache();
}
else {
if ($hook) {
$preEvent = new \Civi\Core\DAO\Event\PreUpdate($this);
- \Civi::service('dispatcher')->dispatch("civi.dao.preInsert", $preEvent);
+ \Civi::dispatcher()->dispatch("civi.dao.preInsert", $preEvent);
}
$result = $this->insert();
if ($hook) {
$event = new \Civi\Core\DAO\Event\PostUpdate($this, $result);
- \Civi::service('dispatcher')->dispatch("civi.dao.postInsert", $event);
+ \Civi::dispatcher()->dispatch("civi.dao.postInsert", $event);
}
}
$this->free();
*/
public function delete($useWhere = FALSE) {
$preEvent = new \Civi\Core\DAO\Event\PreDelete($this);
- \Civi::service('dispatcher')->dispatch("civi.dao.preDelete", $preEvent);
+ \Civi::dispatcher()->dispatch("civi.dao.preDelete", $preEvent);
$result = parent::delete($useWhere);
$event = new \Civi\Core\DAO\Event\PostDelete($this, $result);
- \Civi::service('dispatcher')->dispatch("civi.dao.postDelete", $event);
+ \Civi::dispatcher()->dispatch("civi.dao.postDelete", $event);
$this->free();
$this->clearDbColumnValueCache();
if (!$blockCopyofCustomValues) {
$newObject->copyCustomFields($object->id, $newObject->id);
}
- CRM_Utils_Hook::post('create', CRM_Core_DAO_AllCoreTables::getBriefName(str_replace('_BAO_', '_DAO_', $daoName)), $newObject->id, $newObject);
+ CRM_Utils_Hook::post('create', CRM_Core_DAO_AllCoreTables::getBriefName($daoName), $newObject->id, $newObject);
}
return $newObject;
* @param string $context
* @see CRM_Core_DAO::buildOptionsContext
* @param array $props
- * whatever is known about this bao object.
+ * Raw field values; whatever is known about this bao object.
+ *
+ * Note: $props can contain unsanitized input and should not be passed directly to CRM_Core_PseudoConstant::get
*
* @return array|bool
*/
public static function buildOptions($fieldName, $context = NULL, $props = []) {
// If a given bao does not override this function
$baoName = get_called_class();
- return CRM_Core_PseudoConstant::get($baoName, $fieldName, $props, $context);
+ return CRM_Core_PseudoConstant::get($baoName, $fieldName, [], $context);
}
/**