diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 6a73e59..3db9fe8 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -370,9 +370,9 @@ final class ApiController extends Controller { $expected = $request->getData('expected'); - $helperTemplate = new Template(); - $helperTemplate->name = $request->getData('name') ?? 'Empty'; - $helperTemplate->description = Markdown::parse((string) ($request->getData('description') ?? '')); + $helperTemplate = new Template(); + $helperTemplate->name = $request->getData('name') ?? 'Empty'; + $helperTemplate->description = Markdown::parse((string) ($request->getData('description') ?? '')); $helperTemplate->descriptionRaw = (string) ($request->getData('description') ?? ''); if ($collectionId > 0) { @@ -479,7 +479,7 @@ final class ApiController extends Controller */ private function createReportFromRequest(RequestAbstract $request, ResponseAbstract $response, int $collectionId) : Report { - $helperReport = new Report(); + $helperReport = new Report(); $helperReport->title = (string) ($request->getData('name')); $helperReport->setSource(new NullCollection($collectionId)); $helperReport->setTemplate(new NullTemplate((int) $request->getData('template'))); diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 3e4564f..df47394 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -27,8 +27,6 @@ use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; use phpOMS\Utils\StringUtils; use phpOMS\Views\View; -use Modules\Admin\Models\Account; -use Modules\Media\Models\Collection; /** * Helper controller class. diff --git a/Models/TemplateMapper.php b/Models/TemplateMapper.php index 4eacdba..ca90478 100755 --- a/Models/TemplateMapper.php +++ b/Models/TemplateMapper.php @@ -38,19 +38,19 @@ final class TemplateMapper extends DataMapperAbstract * @since 1.0.0 */ protected static array $columns = [ - 'helper_template_id' => ['name' => 'helper_template_id', 'type' => 'int', 'internal' => 'id'], - 'helper_template_status' => ['name' => 'helper_template_status', 'type' => 'int', 'internal' => 'status'], - 'helper_template_title' => ['name' => 'helper_template_title', 'type' => 'string', 'internal' => 'name'], - 'helper_template_data' => ['name' => 'helper_template_data', 'type' => 'int', 'internal' => 'datatype'], - 'helper_template_standalone' => ['name' => 'helper_template_standalone', 'type' => 'bool', 'internal' => 'isStandalone'], - 'helper_template_expected' => ['name' => 'helper_template_expected', 'type' => 'Json', 'internal' => 'expected'], - 'helper_template_desc' => ['name' => 'helper_template_desc', 'type' => 'string', 'internal' => 'description'], - 'helper_template_desc_raw' => ['name' => 'helper_template_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'], - 'helper_template_media' => ['name' => 'helper_template_media', 'type' => 'int', 'internal' => 'source'], + 'helper_template_id' => ['name' => 'helper_template_id', 'type' => 'int', 'internal' => 'id'], + 'helper_template_status' => ['name' => 'helper_template_status', 'type' => 'int', 'internal' => 'status'], + 'helper_template_title' => ['name' => 'helper_template_title', 'type' => 'string', 'internal' => 'name'], + 'helper_template_data' => ['name' => 'helper_template_data', 'type' => 'int', 'internal' => 'datatype'], + 'helper_template_standalone' => ['name' => 'helper_template_standalone', 'type' => 'bool', 'internal' => 'isStandalone'], + 'helper_template_expected' => ['name' => 'helper_template_expected', 'type' => 'Json', 'internal' => 'expected'], + 'helper_template_desc' => ['name' => 'helper_template_desc', 'type' => 'string', 'internal' => 'description'], + 'helper_template_desc_raw' => ['name' => 'helper_template_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'], + 'helper_template_media' => ['name' => 'helper_template_media', 'type' => 'int', 'internal' => 'source'], 'helper_template_virtual' => ['name' => 'helper_template_virtual', 'type' => 'string', 'internal' => 'virtualPath'], - 'helper_template_creator' => ['name' => 'helper_template_creator', 'type' => 'int', 'internal' => 'createdBy'], - 'helper_template_unit' => ['name' => 'helper_template_unit', 'type' => 'int', 'internal' => 'unit'], - 'helper_template_created' => ['name' => 'helper_template_created', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'], + 'helper_template_creator' => ['name' => 'helper_template_creator', 'type' => 'int', 'internal' => 'createdBy'], + 'helper_template_unit' => ['name' => 'helper_template_unit', 'type' => 'int', 'internal' => 'unit'], + 'helper_template_created' => ['name' => 'helper_template_created', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'], ]; /** diff --git a/tests/Models/ReportMapperTest.php b/tests/Models/ReportMapperTest.php index 00e97a5..84abe04 100755 --- a/tests/Models/ReportMapperTest.php +++ b/tests/Models/ReportMapperTest.php @@ -35,14 +35,14 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase $template = new Template(); $template->createdBy = new NullAccount(1); - $template->name = 'Report Template'; + $template->name = 'Report Template'; $template->setStatus(HelperStatus::ACTIVE); $template->description = 'Description'; $template->setDatatype(TemplateDataType::OTHER); $template->setStandalone(false); $template->setExpected(['source1.csv', 'source2.csv']); - $collection = new Collection(); + $collection = new Collection(); $collection->createdBy = new NullAccount(1); $templateFiles = [ @@ -84,7 +84,7 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase ]; foreach ($templateFiles as $file) { - $media = new Media(); + $media = new Media(); $media->createdBy = new NullAccount(1); $media->extension = $file['extension']; $media->setPath(\trim($file['path'], '/') . '/' . $file['filename']); @@ -109,12 +109,12 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase $report = new Report(); $report->createdBy = new NullAccount(1); - $report->title = 'Title'; + $report->title = 'Title'; $report->setStatus(HelperStatus::ACTIVE); $report->description = 'Description'; $report->setTemplate($this->createTemplate()); - $collection = new Collection(); + $collection = new Collection(); $collection->createdBy = new NullAccount(1); $reportFiles = [ @@ -156,7 +156,7 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase ]; foreach ($reportFiles as $file) { - $media = new Media(); + $media = new Media(); $media->createdBy = new NullAccount(1); $media->extension = $file['extension']; $media->setPath(\trim($file['path'], '/') . '/' . $file['filename']); diff --git a/tests/Models/ReportTest.php b/tests/Models/ReportTest.php index b343c10..bbeede4 100755 --- a/tests/Models/ReportTest.php +++ b/tests/Models/ReportTest.php @@ -137,8 +137,8 @@ class ReportTest extends \PHPUnit\Framework\TestCase public function testToArray() : void { $this->report->setTemplate(new NullTemplate(11)); - $this->report->title = 'testTitle'; - $this->report->description = 'testDescription'; + $this->report->title = 'testTitle'; + $this->report->description = 'testDescription'; $this->report->descriptionRaw = 'testDescriptionRaw'; $array = $this->report->toArray(); @@ -167,8 +167,8 @@ class ReportTest extends \PHPUnit\Framework\TestCase public function testJsonSerialize() : void { $this->report->setTemplate(new NullTemplate(11)); - $this->report->title = 'testTitle'; - $this->report->description = 'testDescription'; + $this->report->title = 'testTitle'; + $this->report->description = 'testDescription'; $this->report->descriptionRaw = 'testDescriptionRaw'; $array = $this->report->jsonSerialize(); diff --git a/tests/Models/TemplateMapperTest.php b/tests/Models/TemplateMapperTest.php index c120492..3c01ada 100755 --- a/tests/Models/TemplateMapperTest.php +++ b/tests/Models/TemplateMapperTest.php @@ -39,15 +39,15 @@ class TemplateMapperTest extends \PHPUnit\Framework\TestCase $template = new Template(); $template->createdBy = new NullAccount(1); - $template->name = 'Title'; + $template->name = 'Title'; $template->setStatus(HelperStatus::ACTIVE); - $template->description = 'Description'; + $template->description = 'Description'; $template->descriptionRaw = 'DescriptionRaw'; $template->setDatatype(TemplateDataType::OTHER); $template->setStandalone(false); $template->setExpected(['source1.csv', 'source2.csv']); - $collection = new Collection(); + $collection = new Collection(); $collection->createdBy = new NullAccount(1); $templateFiles = [ @@ -89,7 +89,7 @@ class TemplateMapperTest extends \PHPUnit\Framework\TestCase ]; foreach ($templateFiles as $file) { - $media = new Media(); + $media = new Media(); $media->createdBy = new NullAccount(1); $media->extension = $file['extension']; $media->setPath(\trim($file['path'], '/') . '/' . $file['filename']); diff --git a/tests/Models/TemplateTest.php b/tests/Models/TemplateTest.php index 3ce22a0..ce7d8a3 100755 --- a/tests/Models/TemplateTest.php +++ b/tests/Models/TemplateTest.php @@ -176,8 +176,8 @@ class TemplateTest extends \PHPUnit\Framework\TestCase */ public function testToArray() : void { - $this->template->name = 'testName'; - $this->template->description = 'testDescription'; + $this->template->name = 'testName'; + $this->template->description = 'testDescription'; $this->template->descriptionRaw = 'testDescriptionRaw'; $this->template->setStandalone(true); @@ -208,8 +208,8 @@ class TemplateTest extends \PHPUnit\Framework\TestCase */ public function testJsonSerialize() : void { - $this->template->name = 'testName'; - $this->template->description = 'testDescription'; + $this->template->name = 'testName'; + $this->template->description = 'testDescription'; $this->template->descriptionRaw = 'testDescriptionRaw'; $this->template->setStandalone(true);