mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 06:40:33 -04:00
Add projects index page, and more detail on placeholder pages
This commit is contained in:
parent
fe5bb8ed48
commit
c7a4e34e31
15 changed files with 211 additions and 59 deletions
|
@ -31,6 +31,11 @@ class Project{
|
|||
protected User $_ReviewerUser;
|
||||
protected string $_Url;
|
||||
|
||||
|
||||
// *******
|
||||
// GETTERS
|
||||
// *******
|
||||
|
||||
protected function GetUrl(): string{
|
||||
if(!isset($this->_Url)){
|
||||
$this->_Url = '/projects/' . $this->ProjectId;
|
||||
|
@ -39,6 +44,11 @@ class Project{
|
|||
return $this->_Url;
|
||||
}
|
||||
|
||||
|
||||
// *******
|
||||
// METHODS
|
||||
// *******
|
||||
|
||||
/**
|
||||
* @throws Exceptions\InvalidProjectException If the `Project` is invalid.
|
||||
*/
|
||||
|
@ -218,4 +228,27 @@ class Project{
|
|||
$this->PropertyFromHttp('ManagerUserId');
|
||||
$this->PropertyFromHttp('ReviewerUserId');
|
||||
}
|
||||
|
||||
|
||||
// ***********
|
||||
// ORM METHODS
|
||||
// ***********
|
||||
|
||||
/**
|
||||
* @throws Exceptions\ProjectNotFoundException If the `Project` can't be found.
|
||||
*/
|
||||
public static function Get(?int $projectId): Project{
|
||||
if($projectId === null){
|
||||
throw new Exceptions\ProjectNotFoundException();
|
||||
}
|
||||
|
||||
return Db::Query('SELECT * from Projects where ProjectId = ?', [$projectId], Project::class)[0] ?? throw new Exceptions\ProjectNotFoundException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<Project>
|
||||
*/
|
||||
public static function GetAllByStatus(Enums\ProjectStatusType $status): array{
|
||||
return Db::Query('SELECT * from Projects where Status = ? order by Started desc', [$status], Project::class);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue