Skip to content
Snippets Groups Projects
Commit 21023d8f authored by Pieter Frenssen's avatar Pieter Frenssen
Browse files

FieldHandlerInterface::getEntity() might return NULL.

parent 453e3e89
No related branches found
No related tags found
No related merge requests found
......@@ -67,6 +67,9 @@ class EventInstanceCapacity extends FieldPluginBase {
*/
public function render(ResultRow $values) {
$event = $this->getEntity($values);
if (!$event) {
return $this->t('N/A');
}
$this->registrationCreationService->setEventInstance($event);
$capacity = (int) $this->registrationCreationService->getEventSeries()->event_registration->capacity;
if ($capacity === -1) {
......
......@@ -26,6 +26,9 @@ class EventInstanceRegistrationAvailability extends FieldPluginBase {
*/
public function render(ResultRow $values) {
$event = $this->getEntity($values);
if (!$event) {
return $this->t('N/A');
}
$capacity = $event->get('availability_count')->getValue()[0]['value'] ?? 0;
if ($capacity === -1) {
......
......@@ -26,6 +26,9 @@ class EventInstanceRegistrationCount extends FieldPluginBase {
*/
public function render(ResultRow $values) {
$eventinstance = $this->getEntity($values);
if (!$eventinstance) {
return $this->t('N/A');
}
return $eventinstance->get('registration_count')->getValue()[0]['value'] ?? 0;
}
......
......@@ -26,6 +26,9 @@ class EventInstanceWaitlistCount extends FieldPluginBase {
*/
public function render(ResultRow $values) {
$event = $this->getEntity($values);
if (!$event) {
return $this->t('N/A');
}
return $event->get('waitlist_count')->getValue()[0]['value'] ?? 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment