Update PropertiesBase to new patterns and improve static analysis checks

This commit is contained in:
Alex Cabal 2022-06-30 13:23:05 -05:00
parent 5f0b57f7e9
commit 6c8414f844
33 changed files with 335 additions and 148 deletions

View file

@ -2,6 +2,9 @@
use Safe\DateTime;
use Ramsey\Uuid\Uuid;
/**
* @property string $Url
*/
class NewsletterSubscriber extends PropertiesBase{
public $NewsletterSubscriberId;
public $Uuid;
@ -14,6 +17,10 @@ class NewsletterSubscriber extends PropertiesBase{
public $Created;
protected $Url = null;
// *******
// GETTERS
// *******
protected function GetUrl(): string{
if($this->Url === null){
$this->Url = SITE_URL . '/newsletter/subscribers/' . $this->Uuid;
@ -22,6 +29,11 @@ class NewsletterSubscriber extends PropertiesBase{
return $this->Url;
}
// *******
// METHODS
// *******
public function Create(): void{
$this->Validate();
@ -78,6 +90,11 @@ class NewsletterSubscriber extends PropertiesBase{
}
}
// ***********
// ORM METHODS
// ***********
public static function Get(string $uuid): NewsletterSubscriber{
$subscribers = Db::Query('SELECT * from NewsletterSubscribers where Uuid = ?;', [$uuid], 'NewsletterSubscriber');