From c16d94a6c11495507f7a718ebe16eac51a6cb3fe Mon Sep 17 00:00:00 2001
From: Kevin Ditscheid <kevin.ditscheid@sgalinski.de>
Date: Thu, 30 Jul 2020 09:33:35 +0200
Subject: [PATCH] [TASK] Relocated extbase persistence configuration to new
 Classes.php

---
 Configuration/Extbase/Persistence/Classes.php | 70 +++++++++++++++++++
 .../TypoScript/Common/setup.typoscript        |  2 +
 2 files changed, 72 insertions(+)
 create mode 100644 Configuration/Extbase/Persistence/Classes.php

diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php
new file mode 100644
index 0000000..1630518
--- /dev/null
+++ b/Configuration/Extbase/Persistence/Classes.php
@@ -0,0 +1,70 @@
+<?php
+declare(strict_types=1);
+
+// if you need to change this, keep in mind the changes need to be done in
+// Configuration/TypoScript/Common/setup.typoscript for TYPO3 9, too
+return [
+	\SGalinski\SgNews\Domain\Model\News::class => [
+		'tableName' => 'pages',
+		'recordType' => \SGalinski\SgNews\Domain\Model\News::DOK_TYPE_NEWS,
+		'properties' => [
+			'highlighted' => [
+				'fieldName' => 'tx_sgnews_highlighted'
+			],
+			'neverHighlighted' => [
+				'fieldName' => 'tx_sgnews_never_highlighted'
+			],
+			'relatedNews' => [
+				'fieldName' => 'tx_sgnews_related_news'
+			],
+			'newsAuthor' => [
+				'fieldName' => 'tx_sgnews_news_author'
+			],
+			'lastUpdated' => [
+				'fieldName' => 'lastUpdated'
+			],
+			'creationDate' => [
+				'fieldName' => 'crdate'
+			],
+			'teaser1Image' => [
+				'fieldName' => 'tx_sgnews_teaser1_image'
+			],
+			'teaser2Image' => [
+				'fieldName' => 'tx_sgnews_teaser2_image'
+			],
+			'tags' => [
+				'fieldName' => 'tx_sgnews_tags'
+			],
+			'likes' => [
+				'fieldName' => 'tx_sgnews_likes'
+			],
+			'contentFromAnotherPage' => [
+				'fieldName' => 'tx_sgnews_content_from_another_page'
+			],
+			'location' => [
+				'fieldName' => 'tx_sgnews_location'
+			],
+			'dateEnd' => [
+				'fieldName' => 'tx_sgnews_date_end'
+			]
+		]
+	],
+	\SGalinski\SgNews\Domain\Model\Category::class => [
+		'tableName' => 'pages',
+		'recordType' => \SGalinski\SgNews\Domain\Model\Category::DOK_TYPE_CATEGORY,
+		'properties' => [
+			'teaser1Image' => [
+				'fieldName' => 'tx_sgnews_teaser1_image'
+			],
+			'teaser2Image' => [
+				'fieldName' => 'tx_sgnews_teaser2_image'
+			]
+		]
+	],
+	\SGalinski\SgNews\Domain\Model\Tag::class => [
+		'tableName' => 'sys_category'
+	],
+	\SGalinski\SgNews\Domain\Model\FileReference::class => [
+		'tableName' => 'sys_file_reference'
+	]
+];
diff --git a/Configuration/TypoScript/Common/setup.typoscript b/Configuration/TypoScript/Common/setup.typoscript
index 5c5bbd5..1223a98 100644
--- a/Configuration/TypoScript/Common/setup.typoscript
+++ b/Configuration/TypoScript/Common/setup.typoscript
@@ -1,6 +1,8 @@
 config.tx_extbase {
 	persistence {
 		classes {
+			# @deprecated This configuration does not work in TYPO3 10 at all, you need to also change
+			# Configuration/Extbase/Persistence/Classes.php
 			SGalinski\SgNews\Domain\Model\News {
 				mapping {
 					tableName = pages
-- 
GitLab