mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 14:50:39 -04:00
25 lines
568 B
PHP
25 lines
568 B
PHP
<?
|
|
class EbookSource{
|
|
public ?int $EbookSourceId = null;
|
|
public ?int $EbookId = null;
|
|
public EbookSourceType $Type;
|
|
public string $Url;
|
|
|
|
public static function FromTypeAndUrl(EbookSourceType $type, string $url): EbookSource{
|
|
$instance = new EbookSource();
|
|
$instance->Type = $type;
|
|
$instance->Url = $url;
|
|
return $instance;
|
|
}
|
|
|
|
public function Create(): void{
|
|
Db::Query('
|
|
INSERT into EbookSources (EbookId, Type, Url)
|
|
values (?,
|
|
?,
|
|
?)
|
|
', [$this->EbookId, $this->Type, $this->Url]);
|
|
|
|
$this->EbookSourceId = Db::GetLastInsertedId();
|
|
}
|
|
}
|