Files
nhgooi.nl/app/Models/NewsImage.php
T
root 30893eb7a7
Build and Deploy / build (push) Failing after 44s
Changes by CLaude
2026-08-18 09:31:05 -01:00

31 lines
718 B
PHP
Executable File

<?php
namespace Model;
class NewsImage extends Model {
public $id;
public $title;
public $author;
public $url;
public function __construct($data, $urlPrefix = '/') {
// Convert arrays to objects for consistent handling
if(is_array($data)) {
$data = (object) $data;
}
parent::__construct($data);
// Ensure title is a string, not an array
if(is_array($this->title)) {
$this->title = $this->title[0] ?? '';
}
// Deserialisatie van JSON heeft url in data,
// lezen uit database heeft file en (als het goed is) urlPrefix
if(isset($data->file)) {
$this->url = $urlPrefix . $data->file;
}
}
}