wip: pmelo

This commit is contained in:
marko
2024-01-20 12:40:00 +01:00
parent d665230ad5
commit 62bd7cb14b
3 changed files with 73 additions and 14 deletions

View File

@@ -241,14 +241,18 @@ SQL;
return $this->name;
}
public function getFirstname()
public function getFirstName()
{
return $this->firstName;
}
public function getConfig()
{
return $this->config;
return $this->$config;
}
public function getStrBirthday(){
return $this->dateOfBirth->format("Y-m-d");
}
// static functions
@@ -325,4 +329,34 @@ SQL;
}
return User::fromDbArray($response[0]);
}
public static function loadFromDbByAttribute(int $attributeId){
$query =
"SELECT DISTINCT" .
" `wkParticipo_Users`.* " .
" FROM `wkParticipo_Users`" .
" JOIN `wkParticipo_user<=>userAttributes`" .
" ON `wkParticipo_user<=>userAttributes`.`userId` = `wkParticipo_Users`.`id`" .
" WHERE `wkParticipo_user<=>userAttributes`.`attributeId` = :attributeId".
" ORDER BY `wkParticipo_Users`.`id` ASC;";
$response = dbConnector::query(
$query
, [
'attributeId'=>[
'value'=>filterId($attributeId)
, 'data_type'=>PDO::PARAM_INT]
]
);
// Postprocessing
// - convert the comma separated list into an array
foreach ($response as &$user) {
$user["eMail"] = explode(",", $user["eMail"]);
foreach ($user["eMail"] as &$email) {
$email = trim($email);
}
}
return $response;
}
}