Asset: guard using property_exists in constructor

This commit is contained in:
Aaron van Geffen 2023-03-11 21:39:20 +01:00
parent 0b0d47acb8
commit aa3a54f237

View File

@ -27,7 +27,10 @@ class Asset
protected function __construct(array $data)
{
foreach ($data as $attribute => $value)
{
if (property_exists($this, $attribute))
$this->$attribute = $value;
}
if (!empty($data['date_captured']) && $data['date_captured'] !== 'NULL')
$this->date_captured = new DateTime($data['date_captured']);