[TYPO3-mvc] Relations to non existing Domain-Models (eg. fe_groups and sys_language)
Benno Weinzierl
benno_weinzierl at web.de
Mon Jul 20 14:07:21 CEST 2009
Hey guys,
i think that Issue #3440 is not a feature as declared but it is a bug that
should be fixed before extbase is out of alpha-state.
The reason:
I have a Model with a relation to fe_groups. There is not yet a Model for
fe_groups but thats not the Problem.
The big problem is that this beakes my plugin with a broken sql-statement
because of a missing classname in the TCA.
It can be easily fixed by the following code:
Index: Classes/Persistence/Mapper/DataMapper.php
===================================================================
--- Classes/Persistence/Mapper/DataMapper.php (revision 970)
+++ Classes/Persistence/Mapper/DataMapper.php (working copy)
@@ -220,7 +220,7 @@
if ($columnMap->getTypeOfRelation() ===
Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_ONE) {
$query = $this->queryFactory->create($columnMap->getChildClassName());
$result =
current($query->matching($query->withUid($row[$columnMap->getColumnName()]))->execute());
- } elseif ($columnMap->getTypeOfRelation() ===
Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
+ } elseif ($columnMap->getTypeOfRelation() ===
Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY &&
$columnMap->getChildClassName()) {
$objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
$query = $this->queryFactory->create($columnMap->getChildClassName());
$objects =
$query->matching($query->equals($columnMap->getParentKeyFieldName(),
$parentObject->getUid()))->execute();
Is it possible to include this? Maybe some more code is needed for the other
relations but this fixes my broken relation to fe_groups.
Benno
More information about the TYPO3-project-typo3v4mvc
mailing list