- Added `attachments` module for creating, reading, updating, and deleting attachments. - Introduced new classes such as `attachments`, `attachment_store`, `attachment_content`, and `attachment_relation` to handle attachment operations and their relationships. - Integrated `attachments` features into `db_object_t` for seamless object-attachment interactions. - Added `attachments_i` interface for standardized attachments module operations. - Created `attachmentsRoute` for defining endpoints related to attachments. - Enabled module configuration through `attachments_enabled_c` for attachment management control.
27 lines
662 B
PHP
27 lines
662 B
PHP
<?php
|
|
|
|
namespace attachments\helpers;
|
|
|
|
class attachment_relation
|
|
{
|
|
public string $object_type; // Type of the object (e.g., 'users_o', 'orders_o', etc.)
|
|
public int $object_id; // ID of the object
|
|
public function __construct(?object $options = null)
|
|
{
|
|
if ($options) {
|
|
foreach ($options as $key => $value) {
|
|
if (property_exists($this, $key)) {
|
|
$this->$key = $value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'object_type' => $this->object_type,
|
|
'object_id' => $this->object_id,
|
|
];
|
|
}
|
|
} |