Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Reuse entities of overridden classes in persistence session
When saving and retrieving object from the persistence session, implementation class names set via \TYPO3\CMS\Extbase\Object\Container are now respected by storing and retrieving them with that overridden class name. Resolves: #77617 Releases: master, 9.5 Change-Id: I887cb164328afe789dc274c92c8f8774b2098a40 Reviewed-on: https://review.typo3.org/58959 Tested-by: TYPO3com <noreply@typo3.com> Reviewed-by: Mona Muzaffar <mona.muzaffar@gmx.de> Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
- Loading branch information
Showing
21 changed files
with
373 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...xtbase/Tests/Functional/Fixtures/Extensions/class_overriding/a/Classes/Domain/Model/A.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace ExtbaseTeam\A\Domain\Model; | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
/** | ||
* Class ExtbaseTeam\A\Domain\Model\A | ||
*/ | ||
class A extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $a; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getA(): string | ||
{ | ||
return $this->a; | ||
} | ||
|
||
/** | ||
* @param string $a | ||
*/ | ||
public function setA(string $a): void | ||
{ | ||
$this->a = $a; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...nctional/Fixtures/Extensions/class_overriding/a/Classes/Domain/Repository/ARepository.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace ExtbaseTeam\A\Domain\Model; | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
use TYPO3\CMS\Extbase\Persistence\Repository; | ||
|
||
/** | ||
* Class ExtbaseTeam\A\Domain\Model\ARepository | ||
*/ | ||
class ARepository extends Repository | ||
{ | ||
} |
25 changes: 25 additions & 0 deletions
25
...nctional/Fixtures/Extensions/class_overriding/a/Configuration/TCA/tx_a_domain_model_a.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
return [ | ||
'ctrl' => [ | ||
'label' => 'uid', | ||
'title' => 'A', | ||
'tstamp' => 'tstamp', | ||
'crdate' => 'crdate', | ||
], | ||
'interface' => [ | ||
'showRecordFieldList' => 'title' | ||
], | ||
'columns' => [ | ||
'a' => [ | ||
'label' => 'a', | ||
'config' => [ | ||
'type' => 'input', | ||
'size' => 25, | ||
'max' => 255, | ||
] | ||
], | ||
], | ||
'types' => [ | ||
'1' => ['showitem' => '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,a'] | ||
], | ||
]; |
21 changes: 21 additions & 0 deletions
21
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/a/ext_emconf.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
$EM_CONF[$_EXTKEY] = [ | ||
'title' => '', | ||
'description' => '', | ||
'category' => 'example', | ||
'author' => '', | ||
'author_company' => '', | ||
'author_email' => '', | ||
'state' => 'stable', | ||
'uploadfolder' => 0, | ||
'createDirs' => '', | ||
'clearCacheOnLoad' => 1, | ||
'version' => '10.0.0', | ||
'constraints' => [ | ||
'depends' => [ | ||
'typo3' => '10.0.0', | ||
], | ||
'conflicts' => [], | ||
'suggests' => [], | ||
], | ||
]; |
2 changes: 2 additions & 0 deletions
2
.../sysext/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/a/ext_localconf.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
defined('TYPO3_MODE') or die(); |
2 changes: 2 additions & 0 deletions
2
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/a/ext_tables.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
defined('TYPO3_MODE') or die(); |
14 changes: 14 additions & 0 deletions
14
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/a/ext_tables.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- | ||
-- Table structure for table 'tx_a_domain_model_a' | ||
-- | ||
CREATE TABLE tx_a_domain_model_a ( | ||
uid int(11) NOT NULL auto_increment, | ||
pid int(11) DEFAULT '0' NOT NULL, | ||
tstamp int(11) DEFAULT '0' NOT NULL, | ||
crdate int(11) DEFAULT '0' NOT NULL, | ||
|
||
a varchar(255) DEFAULT '' NOT NULL, | ||
|
||
PRIMARY KEY (uid), | ||
KEY parent (pid) | ||
); |
44 changes: 44 additions & 0 deletions
44
...xtbase/Tests/Functional/Fixtures/Extensions/class_overriding/b/Classes/Domain/Model/B.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace ExtbaseTeam\B\Domain\Model; | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
/** | ||
* Class ExtbaseTeam\B\Domain\Model\B | ||
*/ | ||
class B extends \ExtbaseTeam\A\Domain\Model\A | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $b; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getB(): string | ||
{ | ||
return $this->b; | ||
} | ||
|
||
/** | ||
* @param string $b | ||
*/ | ||
public function setB(string $b): void | ||
{ | ||
$this->b = $b; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...nctional/Fixtures/Extensions/class_overriding/b/Classes/Domain/Repository/BRepository.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace ExtbaseTeam\B\Domain\Model; | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
use TYPO3\CMS\Extbase\Persistence\Repository; | ||
|
||
/** | ||
* Class ExtbaseTeam\B\Domain\Model\BRepository | ||
*/ | ||
class BRepository extends Repository | ||
{ | ||
} |
17 changes: 17 additions & 0 deletions
17
...ixtures/Extensions/class_overriding/b/Configuration/TCA/Overrides/tx_a_domain_model_a.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns( | ||
'tx_a_domain_model_a', | ||
[ | ||
'b' => [ | ||
'label' => 'b', | ||
'config' => [ | ||
'type' => 'input', | ||
'size' => 25, | ||
'max' => 255, | ||
] | ||
], | ||
] | ||
); | ||
|
||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_a_domain_model_a', 'b'); |
21 changes: 21 additions & 0 deletions
21
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/b/ext_emconf.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
$EM_CONF[$_EXTKEY] = [ | ||
'title' => '', | ||
'description' => '', | ||
'category' => 'example', | ||
'author' => '', | ||
'author_company' => '', | ||
'author_email' => '', | ||
'state' => 'stable', | ||
'uploadfolder' => 0, | ||
'createDirs' => '', | ||
'clearCacheOnLoad' => 1, | ||
'version' => '10.0.0', | ||
'constraints' => [ | ||
'depends' => [ | ||
'typo3' => '10.0.0', | ||
], | ||
'conflicts' => [], | ||
'suggests' => [], | ||
], | ||
]; |
8 changes: 8 additions & 0 deletions
8
.../sysext/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/b/ext_localconf.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
defined('TYPO3_MODE') or die(); | ||
|
||
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class) | ||
->registerImplementation( | ||
\ExtbaseTeam\A\Domain\Model\A::class, | ||
\ExtbaseTeam\B\Domain\Model\B::class | ||
); |
2 changes: 2 additions & 0 deletions
2
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/b/ext_tables.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
defined('TYPO3_MODE') or die(); |
6 changes: 6 additions & 0 deletions
6
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/b/ext_tables.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- | ||
-- Table structure for table 'tx_a_domain_model_a' | ||
-- | ||
CREATE TABLE tx_a_domain_model_a ( | ||
b varchar(255) DEFAULT '' NOT NULL | ||
); |
9 changes: 9 additions & 0 deletions
9
...e/Tests/Functional/Fixtures/Extensions/class_overriding/b/ext_typoscript_setup.typoscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
config.tx_extbase.persistence { | ||
classes { | ||
ExtbaseTeam\B\Domain\Model\B { | ||
mapping { | ||
tableName = tx_a_domain_model_a | ||
} | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...t/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/b/tx_a_domain_model_a.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"tx_a_domain_model_a",,,,,, | ||
,"uid", "pid", "tstamp", "crdate", "a", "b" | ||
,1, 0, 1546178428, 1546178428, "A", "B" |
Oops, something went wrong.