From 1cf98afbe752a936fc43d5c9579daccdc87073e4 Mon Sep 17 00:00:00 2001 From: Lukas Niestroj Date: Mon, 9 Jan 2023 11:51:28 +0100 Subject: [PATCH 1/2] [TASK] add missing subclasses entries in Classes.php * provide a "sublasses" entry for the parent class * add missing "recordType" for the child classes * omit empty lines in generated Classes.php arrays --- .../Configuration/Extbase/Persistence/Classes.phpt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Resources/Private/CodeTemplates/Extbase/Configuration/Extbase/Persistence/Classes.phpt b/Resources/Private/CodeTemplates/Extbase/Configuration/Extbase/Persistence/Classes.phpt index e7d695256..9e1f8a510 100644 --- a/Resources/Private/CodeTemplates/Extbase/Configuration/Extbase/Persistence/Classes.phpt +++ b/Resources/Private/CodeTemplates/Extbase/Configuration/Extbase/Persistence/Classes.phpt @@ -2,13 +2,18 @@ declare(strict_types=1); -return [ +return [ + \{parentClass}::class => [ + 'subclasses' => [ + '{domainObject.recordType}' => \{domainObject.qualifiedClassName}::class, + ], + ], \{domainObject.qualifiedClassName}::class => [ 'tableName' => '{domainObject.databaseTableName}', - 'properties' => [ + 'recordType' => '{domainObject.recordType}','properties' => [ '{property.name}' => [ 'fieldName' => '{property.fieldName}' ], ] - ], -]; + ], +]; From e9c1c2c30fffd8ec8b1c8be624cae0dbd74ece6d Mon Sep 17 00:00:00 2001 From: Lukas Niestroj Date: Tue, 17 Jan 2023 08:50:53 +0100 Subject: [PATCH 2/2] [TASK] remove ext_typoscript_setup.txt Extbase Persistence Generation --- Classes/Service/FileGenerator.php | 21 ---------------- .../Extbase/ext_typoscript_setup.txtt | 25 ------------------- 2 files changed, 46 deletions(-) delete mode 100644 Resources/Private/CodeTemplates/Extbase/ext_typoscript_setup.txtt diff --git a/Classes/Service/FileGenerator.php b/Classes/Service/FileGenerator.php index 224572b07..7ff7b5c25 100644 --- a/Classes/Service/FileGenerator.php +++ b/Classes/Service/FileGenerator.php @@ -504,16 +504,6 @@ protected function generateTyposcriptFiles(): void } catch (Exception $e) { throw new Exception('Could not generate typoscript constants, error: ' . $e->getMessage()); } - - // Generate Static TypoScript - try { - if ($this->extension->getDomainObjectsThatNeedMappingStatements()) { - $fileContents = $this->generateStaticTyposcript(); - $this->writeFile($this->extensionDirectory . 'ext_typoscript_setup.typoscript', $fileContents); - } - } catch (Exception $e) { - throw new Exception('Could not generate static typoscript, error: ' . $e->getMessage()); - } } } @@ -1282,17 +1272,6 @@ public function generateTyposcriptConstants(): ?string ]); } - /** - * @return string|null - * @throws Exception - */ - public function generateStaticTyposcript(): ?string - { - return $this->renderTemplate('ext_typoscript_setup.txtt', [ - 'extension' => $this->extension - ]); - } - /** * @param string $extensionDirectory * @param string $classType diff --git a/Resources/Private/CodeTemplates/Extbase/ext_typoscript_setup.txtt b/Resources/Private/CodeTemplates/Extbase/ext_typoscript_setup.txtt deleted file mode 100644 index bd8a80408..000000000 --- a/Resources/Private/CodeTemplates/Extbase/ext_typoscript_setup.txtt +++ /dev/null @@ -1,25 +0,0 @@ -{namespace k=EBT\ExtensionBuilder\ViewHelpers} - - -config.tx_extbase { - persistence { - classes { - - {parentClass} { - subclasses { - {domainObject.recordType} = {domainObject.qualifiedClassName} - - } - } - {domainObject.qualifiedClassName} { - mapping { - tableName = {domainObject.databaseTableName} - recordType = {domainObject.recordType}columns - {property.mappingStatement} - } - } - } - - } - } -}