Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type hinting #43

Merged
merged 13 commits into from
Nov 24, 2023
Prev Previous commit
Update event_registration.php
  • Loading branch information
schorschy committed Nov 24, 2023
commit 76d14a8abed633750e2039236f141f13e8856e2b
13 changes: 7 additions & 6 deletions lib/event_registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

class event_registration extends \rex_yform_manager_dataset
{
public static function getTotalRegistrationsByDate(int $date_id): object
public static function getTotalRegistrationsByDate(int $date_id): ?rex_yform_manager_collection
{
return self::query()->where('date_id', $date_id)->where('status', '0', '>=')->find();
}

public function getRegistrationPerson(int $status = 0, string $operator = ">="): object {
public function getRegistrationPerson(int $status = 0, string $operator = ">="): ?rex_yform_manager_collection
{
return event_registration_person::query()->where('status', $status, $operator)->where('event_date_id', self::getDateId())->find();
}

Expand All @@ -32,7 +33,7 @@ public function getCategoryId(): int
{
return $this->getValue('category_id');
}
public function getCategory(): object
public function getCategory(): ?rex_yform_manager_collection
{
return $this->getRelatedDataset('category_id');
}
Expand All @@ -42,7 +43,7 @@ public function getDateId(): int
return $this->getValue('date_id');
}

public function getDate(): object
public function getDate(): ?rex_yform_manager_collection
{
return $this->getRelatedDataset('date_id');
}
Expand Down Expand Up @@ -175,7 +176,7 @@ public function hasAcceptedPrivacyPolicy(): bool
return $this->getValue('dsgvo');
}

public static function getByUuid(string $uuid = null): ?object
public static function getByUuid(string $uuid = null): ?rex_yform_manager_collection
{
if (!$uuid) {
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return null;
return;

Reicht so.

Expand All @@ -188,7 +189,7 @@ public function getHash(): string
return $this->getValue('hash');
}

public static function getByHash(string $hash = null): ?object
public static function getByHash(string $hash = null): ?rex_yform_manager_collection
{
if (!$hash) {
return null;
Expand Down
Loading