-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Type hinting #43
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schorschy hier müsstest du nochmal über einige Stellen rüber. Bei vielen, bei denen :object
steht, gehört eigentlich eine Collection hin.
public function getMedia() | ||
public function getMedia(): rex_media | ||
{ | ||
return rex_media::get($this->image); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kannst du hier noch als Weiche einbauen - wenn media_manager_responsive installiert ist, dann rex_media_plus-Objekt zurückgeben.
lib/event_category.php
Outdated
public function getDateWhere($whereRaw = ''): object | ||
{ | ||
return event_date::query()->joinRelation('event_category_id', 'c')->where('c.id', $this->getId())->whereRaw($whereRaw)->orderBy('startDate`, `startTime', 'DESC')->find(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function getDateWhere($whereRaw = ''): object | |
{ | |
return event_date::query()->joinRelation('event_category_id', 'c')->where('c.id', $this->getId())->whereRaw($whereRaw)->orderBy('startDate`, `startTime', 'DESC')->find(); | |
} | |
public function getDateWhere($whereRaw = ''): ?rex_yform_manager_collection | |
{ | |
return event_date::query()->joinRelation('event_category_id', 'c')->where('c.id', $this->getId())->whereRaw($whereRaw)->orderBy('startDate`, `startTime', 'DESC')->find(); | |
} |
public function getRelatedDates($whereRaw = ''): array | ||
{ | ||
return $this->getDateWhere($whereRaw); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function getRelatedDates($whereRaw = ''): array | |
{ | |
return $this->getDateWhere($whereRaw); | |
} | |
public function getRelatedDates($whereRaw = ''): ?rex_yform_manager_collection | |
{ | |
return $this->getDateWhere($whereRaw); | |
} |
public function hasAttribute($needle): bool | ||
{ | ||
return in_array($needle, $this->getAttributes()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function hasAttribute($needle): bool | |
{ | |
return in_array($needle, $this->getAttributes()); | |
} | |
public function hasAttribute($needle): bool | |
{ | |
return in_array($needle, $this->getAttributes(), true); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool kommt nur raus, wenn in_array den 3. Parameter $strict = true hat
lib/event_date.php
Outdated
@@ -13,18 +13,19 @@ public static function generateuuid($id = null) :string | |||
return uuid::uuid3(uuid::NAMESPACE_URL, $id); | |||
} | |||
|
|||
public function getCategory() | |||
public function getCategory(): object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function getCategory(): object | |
public function getCategory(): ?event_category |
{ | ||
if (!$uuid) { | ||
return; | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return null; | |
return; |
Reicht so.
lib/event_registration_person.php
Outdated
public function getRegistration(): object | ||
{ | ||
return $this->getRelatedDataset('registration_id'); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bitte korrigieren
lib/event_registration_person.php
Outdated
public static function getByUuid($uuid = null): object | ||
{ | ||
if (!$uuid) { | ||
return; | ||
} | ||
return self::query()->where('uuid', $uuid)->findOne(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bitte korrigieren
lib/event_registration_person.php
Outdated
public static function getByHash($hash = null): object | ||
{ | ||
if (!$hash) { | ||
return; | ||
} | ||
return self::query()->where('hash', $hash)->findOne(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bitte korrigieren
public static function ep_saved($ep): bool | ||
{ | ||
$lastId = $ep->getSubject()->getLastId(); | ||
$table = $ep->getParam('table'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static function ep_saved($ep): bool | |
{ | |
$lastId = $ep->getSubject()->getLastId(); | |
$table = $ep->getParam('table'); | |
public static function ep_saved(rex_extension_point $ep): bool | |
{ | |
$lastId = $ep->getSubject()->getLastId(); | |
$table = $ep->getParam('table'); |
Ich hab neue commits gepusht, aber kann den pull-request nicht erneut auslösen oder dich irgendwie drauf hinweisen dass es erledigt wurde außer per Kommentar :D kannst mir hierzu ja in der nächsten besprechung den best practice mitteilen. |
No description provided.