33 lines
897 B
PHP
33 lines
897 B
PHP
|
<?php
|
||
|
namespace Bdp\Modules\EventParticipants\Models;
|
||
|
|
||
|
use Bdp\Libs\CommonModel;
|
||
|
use Bdp\Modules\EventParticipants\Controllers\MainController;
|
||
|
|
||
|
class EventParticipant extends CommonModel {
|
||
|
public static function loadById(int $event_id) {
|
||
|
return parent::load_by_id('kompass_veranstaltungen_teilis', $event_id);
|
||
|
}
|
||
|
|
||
|
public static function list_for_event(int $event_id) : array {
|
||
|
global $dbHandler;
|
||
|
|
||
|
$data = $dbHandler->readFromDb('kompass_veranstaltungen_teilis', ['eventId' => $event_id]);
|
||
|
$return = [];
|
||
|
foreach ($data as $participant) {
|
||
|
$part = EventParticipant::loadById($participant->id);
|
||
|
$return[] = $part;
|
||
|
}
|
||
|
|
||
|
return $return;
|
||
|
}
|
||
|
|
||
|
public function get_group() : CommonModel {
|
||
|
return EventGroup::load_by_id(MainController::KOMPASS_EVENTS_GROUPS, $this->gruppe_id);
|
||
|
}
|
||
|
|
||
|
public function __construct() {
|
||
|
$this->_tablename = 'kompass_veranstaltungen_teilis';
|
||
|
}
|
||
|
}
|