Bug #57448
closedExbase propertyMapper caching problem
0%
Description
Got some strange caching problems with the exbase propertyMapper that results in a validation error of a child property because that property isn't correct loaded/fetched.
I get this message when it goes wrong:
BeechIt\Contactpersons\Controller\ContactPersonController->showAction()
Turns out that there is a validation error on the title property of a child object of the requested object.
Did some further debugging and when it goes wrong the debug of the child object looks like:
mainCategory => BeechIt\Contactpersons\Domain\Model\Category [prototype][persistent entity] (uid=76, pid=20) sorting => NULL title => '' (0 chars) description => '' (0 chars) icon => '' (0 chars) parent => NULL uid => 76 (integer) _localizedUid => 76 (integer)modified _languageUid => NULL pid => 20 (integer)
When it goes right the debug of the same object looks like:
mainCategory => BeechIt\Contactpersons\Domain\Model\Category [prototype][persistent entity] (uid=76, pid=20) sorting => 1280 (integer) title => 'Specialisten' (12 chars) description => '' (0 chars) icon => '' (0 chars) parent => TYPO3\CMS\Extbase\Domain\Model\Category [prototype][persistent entity] (uid=72, pid=20) uid => 76 (integer) _localizedUid => 76 (integer)modified _languageUid => 0 (integer)modified pid => 20 (integer)
Looks like the language overlay does not happen (correct) when it goes wrong. See the difference in the _languageUid property.
Problem is that I am not able to tel/force how to reproduce the problem. After a while of debugging it just works again. Looks like a cache is cleared somewhere (auto expire of some exbase cache).
The TCA looks like:
'main_category' => array( 'exclude' => 1, 'l10n_mode' => 'exclude', 'label' => 'LLL:EXT:contactpersons/Resources/Private/Language/locallang_db.xlf:tx_contactpersons_domain_model_contactperson.category', 'config' => array( 'type' => 'select', 'foreign_table' => 'sys_category', 'foreign_table_where' => ' AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.sorting ASC', 'MM' => 'sys_category_record_mm', 'MM_opposite_field' => 'items', 'MM_match_fields' => array( 'tablenames' => 'tx_contactpersons_domain_model_contactperson', 'fieldname' => 'main_category', ), 'renderMode' => 'tree', 'treeConfig' => array( 'parentField' => 'parent', 'appearance' => array( 'expandAll' => FALSE, 'showHeader' => FALSE, 'maxLevels' => 99, ), ), 'size' => 10, 'autoSizeMax' => 20, 'minitems' => 0, 'maxitems' => 1 ), ),
And my model:
/** * Department * * @var \BeechIt\Contactpersons\Domain\Model\Category * @lazy */ protected $mainCategory; /** * Get main category * * @return \TYPO3\CMS\Extbase\Domain\Model\Category */ public function getMainCategory() { return $this->mainCategory; } /** * Set main category * * @param \TYPO3\CMS\Extbase\Domain\Model\Category $category */ public function setMainCategory($category) { $this->mainCategory = $category; }
Where \BeechIt\Contactpersons\Domain\Model\Category extends \TYPO3\CMS\Extbase\Domain\Model\Category
The typoscript mapping for that
plugin.tx_contactpersons { persistence { classes { BeechIt\Contactpersons\Domain\Model\Category { mapping { tableName = sys_category } } } } } <pre>