Commit 22e67bc1 authored by acrollet's avatar acrollet

Update db store invocation

parent efc6634a
...@@ -5,6 +5,8 @@ php = 5.3.9 ...@@ -5,6 +5,8 @@ php = 5.3.9
package = BAT package = BAT
dependencies[] = bat_event
dependencies[] = bat_type
dependencies[] = rest_server dependencies[] = rest_server
dependencies[] = services dependencies[] = services
......
...@@ -873,8 +873,6 @@ function bat_api_services_edit_unit($unit_id, $bat_unit_data) { ...@@ -873,8 +873,6 @@ function bat_api_services_edit_unit($unit_id, $bat_unit_data) {
* @param string $event_types * @param string $event_types
*/ */
function bat_api_services_events_index($target_ids, $target_types, $target_entity_type, $start_date, $end_date, $event_types) { function bat_api_services_events_index($target_ids, $target_types, $target_entity_type, $start_date, $end_date, $event_types) {
global $databases;
$return = new stdClass(); $return = new stdClass();
$return->sessid = session_id(); $return->sessid = session_id();
...@@ -885,8 +883,7 @@ function bat_api_services_events_index($target_ids, $target_types, $target_entit ...@@ -885,8 +883,7 @@ function bat_api_services_events_index($target_ids, $target_types, $target_entit
$events_json = array(); $events_json = array();
foreach ($types as $type) { foreach ($types as $type) {
$prefix = (isset($databases['default']['default']['prefix'])) ? $databases['default']['default']['prefix'] : ''; $event_store = new DrupalDBStore($type, DrupalDBStore::BAT_EVENT, bat_get_db_prefix());
$event_store = new DrupalDBStore($type, DrupalDBStore::BAT_EVENT, $prefix);
$start_date_object = new DateTime($start_date); $start_date_object = new DateTime($start_date);
$end_date_object = new DateTime($end_date); $end_date_object = new DateTime($end_date);
...@@ -954,8 +951,6 @@ function bat_api_services_events_index($target_ids, $target_types, $target_entit ...@@ -954,8 +951,6 @@ function bat_api_services_events_index($target_ids, $target_types, $target_entit
* @param bool $background * @param bool $background
*/ */
function bat_api_services_events_index_calendar($unit_ids, $unit_types, $start_date, $end_date, $event_types, $background) { function bat_api_services_events_index_calendar($unit_ids, $unit_types, $start_date, $end_date, $event_types, $background) {
global $databases;
if ($unit_types == 'all') { if ($unit_types == 'all') {
$unit_types = array(); $unit_types = array();
foreach (bat_unit_get_types() as $type => $info) { foreach (bat_unit_get_types() as $type => $info) {
...@@ -992,8 +987,7 @@ function bat_api_services_events_index_calendar($unit_ids, $unit_types, $start_d ...@@ -992,8 +987,7 @@ function bat_api_services_events_index_calendar($unit_ids, $unit_types, $start_d
$controller = entity_get_controller($target_entity_type); $controller = entity_get_controller($target_entity_type);
// For each type of event create a state store and an event store. // For each type of event create a state store and an event store.
$prefix = (isset($databases['default']['default']['prefix'])) ? $databases['default']['default']['prefix'] : ''; $event_store = new DrupalDBStore($type, DrupalDBStore::BAT_EVENT, bat_get_db_prefix());
$event_store = new DrupalDBStore($type, DrupalDBStore::BAT_EVENT, $prefix);
$start_date_object = new DateTime($start_date); $start_date_object = new DateTime($start_date);
$end_date_object = new DateTime($end_date); $end_date_object = new DateTime($end_date);
...@@ -1219,7 +1213,7 @@ function bat_api_services_matching_units_calendar($unit_types, $start_date, $end ...@@ -1219,7 +1213,7 @@ function bat_api_services_matching_units_calendar($unit_types, $start_date, $end
$controller = entity_get_controller($target_entity_type); $controller = entity_get_controller($target_entity_type);
// For each type of event create a state store and an event store. // For each type of event create a state store and an event store.
$state_store = new DrupalDBStore($event_type, DrupalDBStore::BAT_STATE); $state_store = new DrupalDBStore($event_type, DrupalDBStore::BAT_STATE, bat_get_db_prefix());
$start_date_object = new DateTime($start_date); $start_date_object = new DateTime($start_date);
$end_date_object = new DateTime($end_date); $end_date_object = new DateTime($end_date);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment