Skip to content
Snippets Groups Projects

Exclude anon user from current bookings API

1 file
+ 4
2
Compare changes
  • Side-by-side
  • Inline
@@ -263,8 +263,9 @@ class BookableCalendarOpeningInstance extends ContentEntityBase implements Booka
* @return bool
*/
public function isBookedByCurrentUser() {
$ids = \Drupal::entityQuery('booking_contact')
$ids = $this->entityTypeManager()->getStorage('booking_contact')->getQuery()
->condition('uid', \Drupal::currentUser()->id())
->condition('uid', 0, '<>')
->condition('booking_instance', $this->id())
->accessCheck(FALSE)
->execute();
@@ -277,8 +278,9 @@ class BookableCalendarOpeningInstance extends ContentEntityBase implements Booka
* @return \Drupal\bookable_calendar\Entity\BookingContact[]
*/
public function getBookingContactsByCurrentUser() {
$ids = \Drupal::entityQuery('booking_contact')
$ids = $this->entityTypeManager()->getStorage('booking_contact')->getQuery()
->condition('uid', \Drupal::currentUser()->id())
->condition('uid', 0, '<>')
->condition('booking_instance', $this->id())
->accessCheck(FALSE)
->execute();
Loading