Closed koernchen02 closed 7 years ago
Is there any other way using your technique without using a unique Vendor-Key, that would prevent Extbase from prefering your converter over the TYPO3 ObjectStorageConverter in every other EXT with the same Vendor?
Why do you need to do this? How does "my" ObjectConverter interfere with your needs?
It took me a moment to get back on track with this since it has been some time... But I had the chance today and revived the project to have a look! The problem with your ObjectStorage-Converter in my case is, that it doesn't handle empty storages. With your ObjectStorage-Converter as the "default" some of my properties give me something like this, if no entry is selected :
#1297759968: Exception while property mapping at property path "members":PHP Warning: Invalid argument supplied for foreach() in /var/www/.../typo3conf/ext/cmb_files/Classes/Property/TypeConverter/ObjectStorageConverter.php line 54
That is the "interference" - nothing dramatic...
If I force the use of TYPO3's ObjectStorageConverter like mentioned above, members can be set without problems.
I have no idea if this is still happening with TYPO3 6.2.14 or if you allready patched your stuff. But the question nevertheless really was another. I just wanted to know if there is a way to use "your" ObjectStorageConverter explicitly and per default keep using the TYPO3 Converter.
But you can defintely close this issue if you like, I can ask the same on Slack, which wasn't present at the time I had problems!
Best,
Christian
Hi, I'm using your great code and extended the FileReference Model to add Title and Description to Meta. No I have two problem. The first one is similar as "koernchen02" described above. When I use the Upload TypeConverter (ObjectStorageConverter) and add a new Property (to my Model
Examble:
/**
*/ protected $file = NULL;
/**
*/ protected $abstracttxt = NULL;
I get this error
To set the TypeConverter manually has no effect
$newConfiguration->forProperty('abstracttxt.*')
->setTypeConverterOptions(
'TYPO3\CMS\Extbase\Property\TypeConverter\ObjectStorageConverter',
array()
);
The second Problem: Adding the f3-form-error to the Title and Description field. The Error Class does'nt appear ... But the Validator works! I have tried to set it manuall in the ErrorAction
$imageErrors = $this->arguments->getValidationResults()->forProperty('submission.image')->getSubResults(); $i = 1; foreach ( $imageErrors as $uid => $image) { foreach ( $image->getSubResults() as $property => $error) { $this->arguments->getValidationResults()->forProperty('submission.image.'.$i.'.'.$property)->addError(new \TYPO3\CMS\Extbase\Error\Error('Error', time())); } $i++; }
Would be nice to get info how to do it the right way. ThX Jürgen
I can confirm the bug on Typo3 7.6.11. With your ObjectStorage-Converter as the "default" some of my properties give the following error, if no entry is selected:
#1297759968: Exception while property mapping at property path "myProperty": PHP Warning: Invalid argument supplied for foreach() in /html/typo3/typo3conf/ext/myext/Classes/Property/TypeConverter/ObjectStorageConverter.php line 57
Using the following in initializeCreateAction() or initializeUpdateAction() fixes the issue:
if (isset($this->arguments['event'])) {
$this->arguments['event']
->getPropertyMappingConfiguration()
->forProperty('myProperty')
->setTypeConverter(new \TYPO3\CMS\Extbase\Property\TypeConverter\ObjectStorageConverter());
}
Hello Helmut or Mr. Hummel, I've got a question that keeps bothering me for quite some time now and actually I know that the problem does not reside in your example, rather than in the namespacing conventions of Extbase. Nevertheless I wanted to ask you in person.
For a project of mine, I had to develop a bunch of Extensions like:
\Vendor\Product1\ \Vendor\Product2\
etc.
One of the extensions is responsible for providing uploads and the necessary stuff from your great, great work.
When I have to use an ObjectStorageConverter in any other EXT with the same Vendor as the File-EXT, I have to explicitly tell the Extension to use:
That makes sense, because with the same vendor in all my EXTs, "your" ObjectStorageConverter is always the closest one.
So the question is:
Is there any other way using your technique without using a unique Vendor-Key, that would prevent Extbase from prefering your converter over the TYPO3 ObjectStorageConverter in every other EXT with the same Vendor?