*/
abstract public function getInfo();
+ /**
+ * Get a list of entities to register via API
+ *
+ * @return array list of entities; same format as CRM_Utils_Hook::managedEntities(&$entities)
+ * @see CRM_Utils_Hook::managedEntities
+ */
+ public function getManagedEntities() {
+ return array();
+ }
+
/**
* Provides permissions that are used by component.
* Needs to be implemented in component's information
static $singleton;
if ($fresh || !$singleton) {
$declarations = array();
+ foreach (CRM_Core_Component::getEnabledComponents() as $component) {
+ $declarations = array_merge($declarations, $component->getManagedEntities());
+ }
CRM_Utils_Hook::managed($declarations);
$singleton = new CRM_Core_ManagedEntities(CRM_Core_Module::getAll(), $declarations);
}
$dao->module = $module->name;
$dao->find();
while ($dao->fetch()) {
- if ($todos[$dao->name]) {
+ if (isset($todos[$dao->name]) && $todos[$dao->name]) {
// update existing entity; remove from $todos
$defaults = array('id' => $dao->entity_id, 'is_active' => 1); // FIXME: test whether is_active is valid
$params = array_merge($defaults, $todos[$dao->name]['params']);