- CRM_Core_DAO::executeQuery('DELETE FROM civicrm_managed WHERE id = %1', array(
- 1 => array($dao->id, 'Integer')
- ));
+ if ($doDelete) {
+ $params = array(
+ 'version' => 3,
+ 'id' => $dao->entity_id,
+ );
+ $result = civicrm_api($dao->entity_type, 'delete', $params);
+ if ($result['is_error']) {
+ $this->onApiError($dao->entity_type, 'delete', $params, $result);
+ }
+
+ CRM_Core_DAO::executeQuery('DELETE FROM civicrm_managed WHERE id = %1', array(
+ 1 => array($dao->id, 'Integer')
+ ));
+ }
+ }
+
+ public function getDeclarations() {
+ if ($this->declarations === NULL) {
+ $this->declarations = array();
+ foreach (CRM_Core_Component::getEnabledComponents() as $component) {
+ /** @var CRM_Core_Component_Info $component */
+ $this->declarations = array_merge($this->declarations, $component->getManagedEntities());
+ }
+ CRM_Utils_Hook::managed($this->declarations);
+ $this->declarations = self::cleanDeclarations($this->declarations);
+ }
+ return $this->declarations;