diff --git a/Classes/Domain/Form/Finishers/LoggerFinisher.php b/Classes/Domain/Form/Finishers/LoggerFinisher.php
index bfc7e6c..10df32a 100644
--- a/Classes/Domain/Form/Finishers/LoggerFinisher.php
+++ b/Classes/Domain/Form/Finishers/LoggerFinisher.php
@@ -69,9 +69,9 @@ protected function executeInternal()
}
$data = [
- 'pid' => $this->getTypoScriptFrontendController()->id,
'crdate' => $now,
'tstamp' => $now,
+ 'page' => $this->getTypoScriptFrontendController()->id,
'language' => (int)$context->getPropertyFromAspect('language', 'id', 0),
'identifier' => $formDefinition->getIdentifier(),
'data' => $encodedFormValues,
diff --git a/Classes/Domain/FormLog/Suggestions.php b/Classes/Domain/FormLog/Suggestions.php
index afce532..9c22dcb 100644
--- a/Classes/Domain/FormLog/Suggestions.php
+++ b/Classes/Domain/FormLog/Suggestions.php
@@ -32,7 +32,7 @@ public function getForProperty(string $property): array
'tx_formlog_entries',
'pages',
'page',
- $queryBuilder->expr()->eq('page.uid', $queryBuilder->quoteIdentifier('tx_formlog_entries.pid'))
+ $queryBuilder->expr()->eq('page.uid', $queryBuilder->quoteIdentifier('tx_formlog_entries.page'))
)
->orderBy($property)
->groupBy($property);
diff --git a/Classes/Updates/FormLogEntryPageUpdate.php b/Classes/Updates/FormLogEntryPageUpdate.php
new file mode 100644
index 0000000..9d64117
--- /dev/null
+++ b/Classes/Updates/FormLogEntryPageUpdate.php
@@ -0,0 +1,70 @@
+connectionPool->getQueryBuilderForTable('tx_formlog_entries');
+
+ $affectedRowCount = $queryBuilder
+ ->update('tx_formlog_entries')
+ ->set('page', $queryBuilder->quoteIdentifier('pid'), false)
+ ->set('pid', 0)
+ ->where($queryBuilder->expr()->eq('page', 0))
+ ->executeStatement();
+
+ return $affectedRowCount > 0;
+ }
+
+ public function updateNecessary(): bool
+ {
+ $queryBuilder = $this->connectionPool->getQueryBuilderForTable('tx_formlog_entries');
+
+ $entriesWithoutPageCount = $queryBuilder
+ ->count('*')
+ ->from('tx_formlog_entries')
+ ->where($queryBuilder->expr()->eq('page', 0))
+ ->executeQuery()
+ ->fetchOne();
+
+ return $entriesWithoutPageCount > 0;
+ }
+
+ public function getPrerequisites(): array
+ {
+ return [
+ DatabaseUpdatedPrerequisite::class,
+ ];
+ }
+}
diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php
index 3fdff0c..aa7d0f8 100644
--- a/Configuration/Extbase/Persistence/Classes.php
+++ b/Configuration/Extbase/Persistence/Classes.php
@@ -7,9 +7,6 @@
'submissionDate' => [
'fieldName' => 'crdate',
],
- 'page' => [
- 'fieldName' => 'pid',
- ],
],
],
\Pagemachine\Formlog\Domain\Model\FormLogEntry\Page::class => [
diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml
index 3052ef1..c095b6f 100644
--- a/Configuration/Services.yaml
+++ b/Configuration/Services.yaml
@@ -9,3 +9,6 @@ services:
Pagemachine\Formlog\Controller\Backend\FormLogSuggestController:
public: true
+
+ Pagemachine\Formlog\Updates\FormLogEntryPageUpdate:
+ public: true
diff --git a/Configuration/TCA/tx_formlog_entries.php b/Configuration/TCA/tx_formlog_entries.php
index 12c805d..3172533 100644
--- a/Configuration/TCA/tx_formlog_entries.php
+++ b/Configuration/TCA/tx_formlog_entries.php
@@ -10,21 +10,16 @@
'crdate' => 'crdate',
'tstamp' => 'tstamp',
'delete' => 'deleted',
+ 'rootLevel' => -1,
'readOnly' => true,
'iconfile' => 'EXT:formlog/Resources/Public/Icons/tx_formlog_entries.svg',
],
'types' => [
'0' => [
- 'showitem' => 'crdate, language, identifier, data, finisher_variables',
+ 'showitem' => 'crdate, page, language, identifier, data, finisher_variables',
],
],
'columns' => [
- 'pid' => [
- 'config' => [
- 'type' => 'passthrough',
- 'foreign_table' => 'pages',
- ],
- ],
'crdate' => [
'exclude' => 1,
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.creationDate',
@@ -34,6 +29,18 @@
'eval' => 'datetime',
],
],
+ 'page' => [
+ 'exclude' => 1,
+ 'label' => 'LLL:EXT:formlog/Resources/Private/Language/locallang_db.xml:tx_formlog_entries.page',
+ 'config' => [
+ 'type' => 'group',
+ 'allowed' => 'pages',
+ 'foreign_table' => 'pages',
+ 'maxitems' => 1,
+ 'size' => 1,
+ 'readOnly' => true,
+ ],
+ ],
'language' => [
'exclude' => 1,
'label' => 'LLL:EXT:formlog/Resources/Private/Language/locallang_db.xml:tx_formlog_entries.language',
diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf
index fa3d08a..6e1397d 100644
--- a/Resources/Private/Language/locallang_db.xlf
+++ b/Resources/Private/Language/locallang_db.xlf
@@ -8,6 +8,10 @@
+
+
+
+
diff --git a/Tests/Functional/Domain/Form/Finishers/LoggerFinisherTest.php b/Tests/Functional/Domain/Form/Finishers/LoggerFinisherTest.php
index e8f215d..34669c0 100644
--- a/Tests/Functional/Domain/Form/Finishers/LoggerFinisherTest.php
+++ b/Tests/Functional/Domain/Form/Finishers/LoggerFinisherTest.php
@@ -104,7 +104,7 @@ public function logsSubmittedFormData(array $fields, array $formValues, string $
->select(['*'], 'tx_formlog_entries')
->fetchAssociative();
- self::assertSame(123, $logEntry['pid'] ?? null);
+ self::assertSame(123, $logEntry['page'] ?? null);
self::assertSame($formDefinition->getIdentifier(), $logEntry['identifier'] ?? null);
self::assertSame($expectedData, $logEntry['data'] ?? null);
self::assertSame('[]', $logEntry['finisher_variables'] ?? null);
@@ -232,7 +232,7 @@ public function logsFinisherVariables()
->select(['*'], 'tx_formlog_entries')
->fetchAssociative();
- self::assertSame(123, $logEntry['pid'] ?? null);
+ self::assertSame(123, $logEntry['page'] ?? null);
self::assertSame($formDefinition->getIdentifier(), $logEntry['identifier'] ?? null);
self::assertSame('{"name":"Tester"}', $logEntry['data'] ?? null);
self::assertSame('{"SaveToDatabase":{"insertedUids.0":124}}', $logEntry['finisher_variables'] ?? null);
diff --git a/Tests/Functional/Domain/FormLog/SuggestionsTest.php b/Tests/Functional/Domain/FormLog/SuggestionsTest.php
index d6993e7..8ae8a20 100644
--- a/Tests/Functional/Domain/FormLog/SuggestionsTest.php
+++ b/Tests/Functional/Domain/FormLog/SuggestionsTest.php
@@ -42,17 +42,17 @@ public function returnsSuggestionsForProperty(string $property, array $expected)
'tx_formlog_entries' => [
[
'uid' => 1,
- 'pid' => 2,
+ 'page' => 2,
'identifier' => 'foo',
],
[
'uid' => 2,
- 'pid' => 2,
+ 'page' => 2,
'identifier' => 'foo',
],
[
'uid' => 3,
- 'pid' => 1,
+ 'page' => 1,
'identifier' => 'bar',
],
],
diff --git a/composer.json b/composer.json
index 804a99d..dfe309c 100644
--- a/composer.json
+++ b/composer.json
@@ -27,6 +27,7 @@
"typo3/cms-fluid": "^11.5.4 || ^12.4",
"typo3/cms-form": "^11.5.4 || ^12.4",
"typo3/cms-frontend": "^11.5.4 || ^12.4",
+ "typo3/cms-install": "^11.5.4 || ^12.4",
"typo3fluid/fluid": "^2.3 || ^4.0"
},
"require-dev": {
diff --git a/ext_localconf.php b/ext_localconf.php
index 8dc9822..34fda2e 100644
--- a/ext_localconf.php
+++ b/ext_localconf.php
@@ -1,6 +1,7 @@
'tstamp',
'expirePeriod' => 180,
diff --git a/ext_tables.sql b/ext_tables.sql
index 6ca052e..94b21d8 100644
--- a/ext_tables.sql
+++ b/ext_tables.sql
@@ -1,4 +1,5 @@
CREATE TABLE tx_formlog_entries (
+ page int(11) unsigned DEFAULT '0' NOT NULL,
language int(11) unsigned DEFAULT '0' NOT NULL,
identifier varchar(255) DEFAULT '' NOT NULL,
data mediumtext,