setTable('selfserve_wash_session_tasks'); } public function getObjectProperties(): void { $this->session_id = new object_property($this->table, $this->id, 'session_id', 'int', false); $this->task_id = new object_property($this->table, $this->id, 'task_id', 'int', false); $this->task_text = new object_property($this->table, $this->id, 'task_text', 'string', false); $this->description = new object_property($this->table, $this->id, 'description', 'string', false); $this->services = new object_property($this->table, $this->id, 'services', 'json', false); $this->buttons = new object_property($this->table, $this->id, 'buttons', 'json', false); $this->dynamic_images_vehicle_type = new object_property($this->table, $this->id, 'dynamic_images_vehicle_type', 'string', false); $this->created_at = new object_property($this->table, $this->id, 'created_at', 'timestamp', false); $this->updated_at = new object_property($this->table, $this->id, 'updated_at', 'timestamp', false); $this->deleted_at = new object_property($this->table, $this->id, 'deleted_at', 'timestamp', false); } public function objectChanged(): void { // No dedicated cache invalidation yet. } public function addSnapshot( int $sessionId, ?int $taskId, string $taskText, ?string $description = null, ?array $services = null, ?array $buttons = null, ?int $thumb_position = null, ): self { $this->id = self::add_object([ 'session_id' => $sessionId, 'task_id' => $taskId, 'task_text' => $taskText, 'description' => $description, 'services' => $services, 'buttons' => $buttons, 'dynamic_images_vehicle_type' => (int)$thumb_position, // The rotations to do on the image. ]); $this->getObjectProperties(); $this->objectChanged(); return $this; } public function deleteBySession(int $sessionId): void { global $db; $db->query("DELETE FROM $this->table WHERE session_id = " . (int)$sessionId); } public function listBySession(int $sessionId): array { return $this->getFieldsWhere([ 'session_id' => $sessionId, 'deleted_at' => null, ], ['id', 'task_id', 'task_text', 'description', 'services', 'buttons', 'dynamic_images_vehicle_type']); } }