pdf test routine

This commit is contained in:
2026-08-18 16:00:06 +02:00
parent 14a7cc2738
commit a19cdf6074
18 changed files with 2077 additions and 14 deletions
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddPdfSupportToTemplates extends AbstractMigration
{
public function change(): void
{
// 1) PDF di esempio + metadati pagine sul template
$templates = $this->table('excel_templates');
if (!$templates->hasColumn('sample_pdf')) {
$templates->addColumn('sample_pdf', 'string', [
'limit' => 255,
'null' => true,
'default' => null,
'after' => 'sample_xlsx',
'comment' => 'Filename of the sample PDF used to draw regions',
]);
}
if (!$templates->hasColumn('pdf_page_meta')) {
$templates->addColumn('pdf_page_meta', 'text', [
'null' => true,
'default' => null,
'comment' => 'JSON: pages count and rendered dimensions per page',
]);
}
$templates->update();
// 2) Riquadri (etichetta + dato) per ogni campo mappato
$mapping = $this->table('template_mapping');
if (!$mapping->hasColumn('pdf_regions')) {
$mapping->addColumn('pdf_regions', 'text', [
'null' => true,
'default' => null,
'after' => 'json_node',
'comment' => 'JSON: {page, label:{x,y,w,h}, value:{x,y,w,h}}',
]);
}
$mapping->update();
}
}
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddPdfToSourceTypeEnum extends AbstractMigration
{
public function up(): void
{
$this->execute(
"ALTER TABLE `excel_templates`
MODIFY `source_type` ENUM('XLS','API','PDF') NOT NULL DEFAULT 'XLS'"
);
}
public function down(): void
{
$this->execute(
"ALTER TABLE `excel_templates`
MODIFY `source_type` ENUM('XLS','API') NOT NULL DEFAULT 'XLS'"
);
}
}