@ -25,11 +25,13 @@ function reserve_categories($ebundle = null) {
$ids = array_filter($fconfig['categories']);
}
else {
$ids = Drupal::service('entity.query')
->get('reserve_category')
->condition('status', TRUE)
$query = \Drupal::service('entity_type.manager')->getStorage('reserve_category')->getQuery();
$ids = $query->condition('status', TRUE)->execute();
//$ids = Drupal::service('entity.query')
//->get('reserve_category')
//->condition('status', TRUE)
//->sort('reserve_display_order', 'ASC')
->execute();
// ->execute();
}
$cats = \Drupal::entityTypeManager()->getStorage('reserve_category')->loadMultiple($ids);
@ -59,9 +61,11 @@ function reserve_categories($ebundle = null) {
function reserve_entities($ebundle) {
$entity_type = ebundle_split($ebundle, 'type');
$bundle = ebundle_split($ebundle, 'bundle');
$query = Drupal::service('entity.query')
->get($entity_type)
->condition('status', TRUE);
$query = \Drupal::service('entity_type.manager')->getStorage($entity_type)->getQuery();
$query->condition('status', TRUE);
//$query = Drupal::service('entity.query')
// ->get($entity_type)
// ->condition('status', TRUE);
if ($entity_type != $bundle) {
$query->condition('type', $bundle);
@ -805,9 +809,8 @@ function reserve_valid_lengths($rid, $ebundle, $yyyy_mmdd, $time, $id = NULL, $a
$start_time = $search_item['start_time'];
$conflicts_found = false;
$query = Drupal::service('entity.query')
->get('reserve_reservation')
$query = \Drupal::service('entity_type.manager')->getStorage('reserve_reservation')->getQuery()
//$query = Drupal::service('entity.query')
->condition('reservation_date', $date . '%', 'LIKE')
->condition('reservation_time', $start_time)
->condition('reservable_id', $rid)
@ -936,8 +939,8 @@ function reserve_daily_max_exceeded($yyyy_mmdd) {
$record_count = 0;
if ($user->uid) {
$ids = \Drupal::service('entity.query' )
->get('reserve_reservation ')
$ids = \Drupal::service('entity_type.manager')->getStorage('reserve_reservation')->getQuery( )
//$ids = \Drupal::service('entity.query ')
->condition('user_id', $user->id)
->condition('reservation_date', 'value', $yyyy_mmdd . '%', 'like')
->execute();
@ -970,9 +973,9 @@ function reserve_user_reservations() {
if ($user->id()) {
$earliest_date = date('Y-m-d', strtotime(date('Y-m-d')));
$latest_date = date('Y-m-d', strtotime("now +13 days"));
$ids = \Drupal::service('entity.query')
->get('reserve_reservation')
$ids = \Drupal::service('entity_type.manager')->getStorage('reserve_reservation')->getQuery()
// $ids = \Drupal::service('entity.query')
// ->get('reserve_reservation')
->condition('user_id', $user->id())
->condition('reservation_date', $earliest_date, '>=')
->condition('reservation_date', $latest_date, '< =')
@ -1032,7 +1035,7 @@ function reserve_yyyymmdd($month, $day) {
*/
function reserve_get_reserve_bundles() {
$bundles = array();
$fieldmap = \Drupal::entityManager( )->getFieldMap();
$fieldmap = \Drupal::service('entity_field.manager' )->getFieldMap();
foreach ($fieldmap as $entity_type => $typedef) {
foreach ($typedef as $field) {
if ($field['type'] == 'reserve_category') {
@ -1050,7 +1053,7 @@ function reserve_get_reserve_bundles() {
* OR specific field name if $ebundle is provided (e.g. node.room)
*/
function reserve_category_fields($ebundle = NULL) {
$fieldmap = \Drupal::entityManager( )->getFieldMap();
$fieldmap = \Drupal::service('entity_field.manager' )->getFieldMap();
$fields = [];
foreach ($fieldmap as $entity_type => $typedef) {
foreach ($typedef as $name => $field) {