Bug #54289
closedUsing Tx_Extbase_Persistence_ObjectStorage doesn't work in rewritten PropertyMapper
100%
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
Updated by Stefan Froemken almost 11 years ago
- Project changed from 534 to TYPO3 Core
- Category deleted (
Extbase: Property) - Assignee set to Thomas Maroschik
- Priority changed from Should have to Must have
Moved to Core
Updated by Helmut Hummel almost 11 years ago
- 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>
Updated by Helmut Hummel almost 11 years ago
- Status changed from New to Needs Feedback
Updated by Stefan Froemken almost 11 years ago
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.
Updated by Marc Bastian Heinrichs almost 11 years ago
- 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.
Updated by Marc Bastian Heinrichs almost 11 years ago
- Assignee set to Stefan Froemken
Updated by Marc Bastian Heinrichs almost 11 years ago
- 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.
Updated by Marc Bastian Heinrichs almost 11 years ago
- 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
Updated by Frans Saris almost 11 years ago
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);
Updated by Gerrit Code Review almost 11 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26578
Updated by Helmut Hummel almost 11 years ago
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?
Updated by Helmut Hummel almost 11 years ago
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...
Updated by Gerrit Code Review almost 11 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26578
Updated by Gerrit Code Review almost 11 years ago
Patch set 1 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27262
Updated by Gerrit Code Review almost 11 years ago
Patch set 2 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27262
Updated by Frans Saris almost 11 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 1ee4086e4e736e10f360e5dc980011336d677e34.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed