**Entity anlegen: hook_entity_info** [[http://drupal.org/search/apachesolr_multisitesearch/hook_entity_info|search...]]
function aktionen_entity_info() {
return array(
'aktionen' => array(
'label' => t('Actions'),
'base table' => 'aktionen',
// overwrite controller for DB access
'controller class' => 'AktionenController',
'entity keys' => array(
'id' => 'aid',
'label' => 'label',
),
'static cache' => FALSE,
),
);
}
**Überschreibe Controler für den Zugriff auf externe Datenbank**
class AktionenController extends DrupalDefaultEntityController {
protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
// set (Database)$activeKey to 'extern'
$old_key = Database::setActiveConnection('extern');
// build the query on the extern-DB
$query = parent::buildQuery($ids, $conditions, $revision_id);
// reset $activeKey
Database::setActiveConnection($old_key);
return $query;
}
}