Bug #54289
closed
Using Tx_Extbase_Persistence_ObjectStorage doesn't work in rewritten PropertyMapper
Added by Stefan Froemken almost 11 years ago.
Updated about 7 years ago.
Description
Hello Extbase-Team,
I have a model with a MM relation to Categories. As this extension was programmed in TYPO3 4.7 I use the old names Tx_Extbase_Persistence_ObjectStorage, but on creating the record extbase throws an Exception:
Current GIT Version: 09.12.2013
Exception while property mapping at property path "categories":Class Tx_Extbase_Persistence_ObjectStorage<Tx_JwCategories_Domain_Model_Category> does not exist
I also have tested this issue with TYPO3 6.1:
Exception while property mapping at property path "categories":No converter found which can be used to convert from "array" to "Tx_Extbase_Persistence_ObjectStorage".
So this problem seems to be in full TYPO3 6.* tree.
@Thomas: Hint: There is no getEarlyInstance() method in TYPO3 < 6.2
- Project changed from 534 to TYPO3 Core
- Category deleted (
Extbase: Property)
- Assignee set to Thomas Maroschik
- Priority changed from Should have to Must have
- Is Regression set to No
- TYPO3 Version set to 6.2
Stefan Froemken wrote:
Exception while property mapping at property path "categories":Class Tx_Extbase_Persistence_ObjectStorage<Tx_JwCategories_Domain_Model_Category> does not exist
This looks like a space is missing between collection type Tx_Extbase_Persistence_ObjectStorage and object type <Tx_JwCategories_Domain_Model_Category>
- Status changed from New to Needs Feedback
A space is missing?!?! In my last 4 years with extbase I have never seen and needed a space between ObjectStorage and Subclass. I just have debugged this part and both types were extracted successful.
- Assignee deleted (
Thomas Maroschik)
- Priority changed from Must have to Should have
- Complexity deleted (
easy)
Without space should be correct. Which mapper do you use?
The rewritten property mapper strips away everthing with beginning "<" and there is a typeconverter from array to Tx_Extbase_Persistence_ObjectStorage in 4.7.
And never had issues with the old property mapper and ObjectStorages.
- Assignee set to Stefan Froemken
- Category set to Extbase
- Status changed from Needs Feedback to Accepted
- Assignee deleted (
Stefan Froemken)
- Priority changed from Should have to Must have
After reading the code it seems that property mapper only know the namespaced ObjectStorage as target type.
So this bug should be fixed.
- Subject changed from Using old class names does not work in new PM for $targetType to Using Tx_Extbase_Persistence_ObjectStorage doesn't work in rewritten PropertyMapper
Think I found the source of the problem. \TYPO3\CMS\Extbase\Property\PropertyMapper::findFirstEligibleTypeConverterInObjectHierarchy() doesn't return the right converter.
As Tx_Extbase_Persistence_ObjectStorage is a alias for \TYPO3\CMS\Extbase\Persistence\ObjectStorage the class_parents() doesn't return the wanted results.
You would think \TYPO3\CMS\Extbase\Persistence\ObjectStorage is a parent of Tx_Extbase_Persistence_ObjectStorage but with alias class that doesn't work that way.
The problem can be solved by using the original name instead of the alias.
Adding the following to the top of findFirstEligibleTypeConverterInObjectHierarchy() resolves the problem here. But I'm uncertain if this location is the right location. Maby it should be checked earlier in the chain.
$targetClass = \TYPO3\CMS\Core\Core\ClassLoader::getClassNameForAlias($targetClass);
- Status changed from Accepted to Under Review
Frans Saris wrote:
Think I found the source of the problem. \TYPO3\CMS\Extbase\Property\PropertyMapper::findFirstEligibleTypeConverterInObjectHierarchy() doesn't return the right converter.
As Tx_Extbase_Persistence_ObjectStorage is a alias for \TYPO3\CMS\Extbase\Persistence\ObjectStorage the class_parents() doesn't return the wanted results.
You would think \TYPO3\CMS\Extbase\Persistence\ObjectStorage is a parent of Tx_Extbase_Persistence_ObjectStorage but with alias class that doesn't work that way.
The problem can be solved by using the original name instead of the alias.
What I do not understand is, that is worked in 6.0.
Any idea what broke for 6.2 or 6.1?
Helmut Hummel wrote:
What I do not understand is, that is worked in 6.0.
Any idea what broke for 6.2 or 6.1?
Hm, at least I think it worked...
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF