Files
api/services/nginx/app/modules/attachments/helpers/attachment_content.php
T
Jeppe Bundgaard d3d3657dfd Generate and attach wash certificate to orders
- Added `generateWashCertificate` method to `orders_o` for wash certificate PDF generation and attachment.
- Introduced `OTHER_TYPE_WASH_CERTIFICATE` constant in `attachment_content` for new attachment type.
- Added `/order/wash-certificate` route to provide wash certificate generation functionality via API.
2025-12-03 08:45:13 +01:00

52 lines
1.6 KiB
PHP

<?php
namespace attachments\helpers;
class attachment_content
{
const OTHER_TYPE_WASH_CERTIFICATE = 'WASH_CERTIFICATE';
public ?string $image; // Used to store the attachment object name, in the attachment store.
public ?string $document; // Used to store the attachment object name, in the attachment store.
public ?attachment_relation $relation; // Used to store the attachment relation object.
public mixed $other; // Used to store the attachment object. (if any other type)
public function __construct(?object $data = null)
{
$this->image = $data->image ?? null;
$this->document = $data->document ?? null;
$this->relation = isset($data->relation) ? new attachment_relation($data->relation) : null;
$this->other = $data->other ?? null;
}
public function toArray(): array
{
return [
'image' => $this->image,
'document' => $this->document,
'relation' => $this->relation ? $this->relation->toArray() : null,
'other' => $this->other,
];
}
/** Setters */
public function setOther(mixed $string): self
{
$this->other = $string;
return $this;
}
public function setImage(string $string): self
{
$this->image = $string;
return $this;
}
public function setDocument(string $string): self
{
$this->document = $string;
return $this;
}
public function setRelation(attachment_relation $relation): self
{
$this->relation = $relation;
return $this;
}
}