Bug #36115
TYPO3.Media: Properties cannot be mapped
Status: | Closed | Start date: | 2012-04-15 | |
---|---|---|---|---|
Priority: | -- undefined -- | Due date: | ||
Assigned To: | Adrian Föder | % Done: | 0% |
|
Category: | - | |||
Target version: | - |
Description
I tried to persist a \TYPO3\Media\Domain\Model\Image to database after submitting a fluid form and got the following Exception:
Property "name" was not found in target object of type "Acme\MyApp\Domain\Model\Participant". 20 TYPO3\FLOW3\Property\TypeConverter\PersistentObjectConverter_Original::getTypeOfChildProperty("Acme\MyApp\Domain\Model\Participant", "name", TYPO3\FLOW3\Mvc\Controller\MvcPropertyMappingConfiguration) 19 TYPO3\FLOW3\Property\PropertyMapper_Original::doMapping(array, "Acme\MyApp\Domain\Model\Participant", TYPO3\FLOW3\Mvc\Controller\MvcPropertyMappingConfiguration, array) 18 TYPO3\FLOW3\Property\PropertyMapper_Original::convert(array, "Acme\MyApp\Domain\Model\Participant", TYPO3\FLOW3\Mvc\Controller\MvcPropertyMappingConfiguration) 17 TYPO3\FLOW3\Mvc\Controller\Argument_Original::setValue(array) 16 TYPO3\FLOW3\Mvc\Controller\AbstractController::mapRequestArgumentsToControllerArguments() 15 TYPO3\FLOW3\Mvc\Controller\ActionController_Original::processRequest(TYPO3\FLOW3\Mvc\ActionRequest, TYPO3\FLOW3\Http\Response) 14 TYPO3\FLOW3\Mvc\Dispatcher_Original::dispatch(TYPO3\FLOW3\Mvc\ActionRequest, TYPO3\FLOW3\Http\Response) 13 TYPO3\FLOW3\Mvc\Dispatcher::dispatch(TYPO3\FLOW3\Mvc\ActionRequest, TYPO3\FLOW3\Http\Response) 12 call_user_func_array(array, array) 11 TYPO3\FLOW3\Mvc\Dispatcher::FLOW3_Aop_Proxy_invokeJoinPoint(TYPO3\FLOW3\Aop\JoinPoint) 10 TYPO3\FLOW3\Aop\Advice\AdviceChain::proceed(TYPO3\FLOW3\Aop\JoinPoint) 9 TYPO3\FLOW3\Security\Aspect\RequestDispatchingAspect_Original::setAccessDeniedResponseHeader(TYPO3\FLOW3\Aop\JoinPoint) 8 TYPO3\FLOW3\Aop\Advice\AroundAdvice::invoke(TYPO3\FLOW3\Aop\JoinPoint) 7 TYPO3\FLOW3\Aop\Advice\AdviceChain::proceed(TYPO3\FLOW3\Aop\JoinPoint) 6 TYPO3\FLOW3\Security\Aspect\RequestDispatchingAspect_Original::blockIllegalRequestsAndForwardToAuthenticationEntryPoints(TYPO3\FLOW3\Aop\JoinPoint) 5 TYPO3\FLOW3\Aop\Advice\AroundAdvice::invoke(TYPO3\FLOW3\Aop\JoinPoint) 4 TYPO3\FLOW3\Aop\Advice\AdviceChain::proceed(TYPO3\FLOW3\Aop\JoinPoint) 3 TYPO3\FLOW3\Mvc\Dispatcher::dispatch(TYPO3\FLOW3\Mvc\ActionRequest, TYPO3\FLOW3\Http\Response) 2 TYPO3\FLOW3\Http\RequestHandler::handleRequest() 1 TYPO3\FLOW3\Core\Bootstrap::run()
I var_dumped in the \TYPO3\FLOW3\Property\PropertyMapper::doMapping() function the var $typeConverter->getSourceChildPropertiesToBeConverted($source) and got this:
array(12) { ["firstname"]=> string(4) "Karl" ["lastname"]=> string(8) "Schuster" ["address"]=> string(15) "Musterstraße 1" ["zip"]=> string(5) "12345" ["city"]=> string(11) "Musterstadt" ["email"]=> string(16) "karl@mydomain.com" ["photo"]=> array(1) { ["resource"]=> array(1) { ["submittedFile"]=> array(2) { ["fileName"]=> string(0) "" ["resourcePointer"]=> string(0) "" } } } ["name"]=> array(1) { ["photo"]=> array(1) { ["resource"]=> string(5) "1.jpg" } } ["type"]=> array(1) { ["photo"]=> array(1) { ["resource"]=> string(10) "image/jpeg" } } ["tmp_name"]=> array(1) { ["photo"]=> array(1) { ["resource"]=> string(24) "C:\xampp\tmp\php923B.tmp" } } ["error"]=> array(1) { ["photo"]=> array(1) { ["resource"]=> int(0) } } ["size"]=> array(1) { ["photo"]=> array(1) { ["resource"]=> int(1099718) } } }
My fluid form contains:
1<f:form action="create" object="{newParticipant}" name="newParticipant" enctype="multipart/form-data">
2[...]
3 <label for="photo">Foto</label><br />
4 <f:form.upload property="photo.resource" id="photo" /><br />
5[...]
6</f:form>
Related issues
History
#1 Updated by Adrian Föder over 3 years ago
- Category changed from - Error Handler Report - to Property
- Status changed from New to Needs Feedback
Florian, could you please correct the array dump to a correctly indented one (i.e. wrapped in pre...
tags) and say what type the photo
property of your newParticipant
is? If photo
itself is the \Image, you should change
1<f:form.upload property="photo.resource" id="photo" />
2
3to
4
5<f:form.upload property="photo" id="photo" />
#2 Updated by Adrian Föder over 3 years ago
- Project changed from TYPO3.Flow to TYPO3.Media
- Category deleted (
Property)
#3 Updated by Florian Carstens over 3 years ago
I'm sorry, of course. Here's the dump with pre-Tags:
array(12) { ["firstname"]=> string(4) "Karl" ["lastname"]=> string(8) "Schuster" ["address"]=> string(15) "Musterstraße 1" ["zip"]=> string(5) "12345" ["city"]=> string(11) "Musterstadt" ["email"]=> string(16) "karl@schuster.de" ["photo"]=> array(1) { ["resource"]=> array(1) { ["submittedFile"]=> array(2) { ["fileName"]=> string(0) "" ["resourcePointer"]=> string(0) "" } } } ["name"]=> array(1) { ["photo"]=> array(1) { ["resource"]=> string(5) "6.jpg" } } ["type"]=> array(1) { ["photo"]=> array(1) { ["resource"]=> string(10) "image/jpeg" } } ["tmp_name"]=> array(1) { ["photo"]=> array(1) { ["resource"]=> string(24) "C:\xampp\tmp\phpB413.tmp" } } ["error"]=> array(1) { ["photo"]=> array(1) { ["resource"]=> int(0) } } ["size"]=> array(1) { ["photo"]=> array(1) { ["resource"]=> int(1111684) } } }
It looks like this ist not an issue with TYPO3.Media but with the core PropertyMapping (see Bug #36114).
#4 Updated by Florian Carstens over 3 years ago
Yes, the property "photo" is of type \TYPO3\Media\Domain\Model\Image. But if I change my form field from property "photo.resource" to "photo" I get this Exception:
#1297759968: Exception while property mapping at property path "photo.submittedFile": The target type was no string, but of type "NULL"
22 TYPO3\FLOW3\Property\PropertyMapper_Original::findTypeConverter(array, NULL, TYPO3\FLOW3\Property\PropertyMappingConfiguration) 21 TYPO3\FLOW3\Property\PropertyMapper_Original::doMapping(array, NULL, TYPO3\FLOW3\Property\PropertyMappingConfiguration, array) 20 TYPO3\FLOW3\Property\PropertyMapper_Original::doMapping(array, "TYPO3\Media\Domain\Model\Image", TYPO3\FLOW3\Property\PropertyMappingConfiguration, array) 19 TYPO3\FLOW3\Property\PropertyMapper_Original::doMapping(array, "Acme\MyApp\Domain\Model\Participant", TYPO3\FLOW3\Mvc\Controller\MvcPropertyMappingConfiguration, array) 18 TYPO3\FLOW3\Property\PropertyMapper_Original::convert(array, "Acme\MyApp\Domain\Model\Participant", TYPO3\FLOW3\Mvc\Controller\MvcPropertyMappingConfiguration) 17 TYPO3\FLOW3\Mvc\Controller\Argument_Original::setValue(array) 16 TYPO3\FLOW3\Mvc\Controller\AbstractController::mapRequestArgumentsToControllerArguments() 15 TYPO3\FLOW3\Mvc\Controller\ActionController_Original::processRequest(TYPO3\FLOW3\Mvc\ActionRequest, TYPO3\FLOW3\Http\Response) 14 TYPO3\FLOW3\Mvc\Dispatcher_Original::dispatch(TYPO3\FLOW3\Mvc\ActionRequest, TYPO3\FLOW3\Http\Response) 13 TYPO3\FLOW3\Mvc\Dispatcher::dispatch(TYPO3\FLOW3\Mvc\ActionRequest, TYPO3\FLOW3\Http\Response) 12 call_user_func_array(array, array) 11 TYPO3\FLOW3\Mvc\Dispatcher::FLOW3_Aop_Proxy_invokeJoinPoint(TYPO3\FLOW3\Aop\JoinPoint) 10 TYPO3\FLOW3\Aop\Advice\AdviceChain::proceed(TYPO3\FLOW3\Aop\JoinPoint) 9 TYPO3\FLOW3\Security\Aspect\RequestDispatchingAspect_Original::setAccessDeniedResponseHeader(TYPO3\FLOW3\Aop\JoinPoint) 8 TYPO3\FLOW3\Aop\Advice\AroundAdvice::invoke(TYPO3\FLOW3\Aop\JoinPoint) 7 TYPO3\FLOW3\Aop\Advice\AdviceChain::proceed(TYPO3\FLOW3\Aop\JoinPoint) 6 TYPO3\FLOW3\Security\Aspect\RequestDispatchingAspect_Original::blockIllegalRequestsAndForwardToAuthenticationEntryPoints(TYPO3\FLOW3\Aop\JoinPoint) 5 TYPO3\FLOW3\Aop\Advice\AroundAdvice::invoke(TYPO3\FLOW3\Aop\JoinPoint) 4 TYPO3\FLOW3\Aop\Advice\AdviceChain::proceed(TYPO3\FLOW3\Aop\JoinPoint) 3 TYPO3\FLOW3\Mvc\Dispatcher::dispatch(TYPO3\FLOW3\Mvc\ActionRequest, TYPO3\FLOW3\Http\Response) 2 TYPO3\FLOW3\Http\RequestHandler::handleRequest() 1 TYPO3\FLOW3\Core\Bootstrap::run()
#5 Updated by Adrian Föder over 3 years ago
- Assigned To set to Adrian Föder
- Priority changed from Must have to -- undefined --
Florian, assuming you're using some kind of Firebug etc., could you please provide also a dump of what was POSTed to the request? I mean the plain, actual parameters that were sent to the server.
#6 Updated by Dominique Feyer almost 3 years ago
I have the same problem,
The exception:
#1297759968: Exception while property mapping for target type "Ttree\Medialib\Core\Domain\Model\Domain", at property path "preferences.headerImage.name": The target type was no string, but of type "NULL" (More information) TYPO3\Flow\Property\Exception thrown in file /Users/dfeyer/Sites/dev/medialib.tv.ttree.dev/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Flow_Property_PropertyMapper_Original.php in line 128. Reference code: 20121102143520865cdd
here's is my var_dump
array(2) '__identity' (10) => '9d407eac-7413-4aa3-bfd7-75b6ce71df83' (36) 'preferences' (11) => array(6) '__identity' (10) => 'b1c8f5cc-ce3f-4a11-bc94-3f0f57adacfc' (36) 'name' (4) => 'medialib.tv - votre portail de vidéo à la demande' (51) 'notificationEmail' (17) => 'dfeyer@ttree.ch' (15) 'description' (11) => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin rhoncus turpis sit amet dolor commodo vel convallis urna condimentum. Sed imperdiet dolor lacinia odio commodo porttitor venenatis eget felis. Ut fermentum, justo et lacinia gravida, tellus augue pretium arcu, et eleifend nulla nulla eget turpis. Aenean ut sem mauris, in luctus neque. Vivamus vehicula rhoncus rhoncus. Ut a purus vel ipsum feugiat ultricies sit amet vitae tellus. Aliquam in neque at elit sagittis bibendum ac non tellus. Maecenas porttitor convallis nisl, ut accumsan mauris elementum sed. Pellentesque sollicitudin nibh at augue laoreet vehicula. Pellentesque non elit nulla, at cursus diam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec nec odio in ante pretium congue. Morbi vestibulum accumsan dui, nec venenatis felis interdum at. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut condimentum eros sagittis neque vulputate egestas. Etiam tincidunt mauris non tellus fringilla hendrerit.' (1072) 'copyrightNotice' (15) => '(c) 2012, ttree sàrl, etiam tincidunt mauris non tellus fringilla hendrerit' (76) 'headerImage' (11) => array(5) 'name' (4) => 'summer1b_20070609.jpg' (21) 'type' (4) => 'image/jpeg' (10) 'tmp_name' (8) => '/private/tmp/php74BeoW' (22) 'error' (5) => integer 0 'size' (4) => integer 600011
And here the request detail
domain[__identity] 9d407eac-7413-4aa3-bfd7-75b6ce71df83 domain[preferences][__identity] b1c8f5cc-ce3f-4a11-bc94-3f0f57adacfc __referrer[@package] Ttree.Medialib __referrer[@subpackage] Backoffice __referrer[@controller] DomainPreferences __referrer[@action] edit __referrer[arguments] YTowOnt9a14faf441d0affdfe4d501cc3de908b83610592f __trustedProperties a:1:{s:6:"domain";a:2:{s:11:"preferences";a:6:{s:4:"name";i:1;s:10:"__identity";i:1;s:17:"notificationEmail";i:1;s:11:"description";i:1;s:15:"copyrightNotice";i:1;s:11:"headerImage";i:1;}s:10:"__identity";i:1;}}3592d7372e31c171c6fd4313babe1fc34d0a63d0 domain[preferences][name] medialib.tv - votre portail de vidéo à la demande domain[preferences][notificationEmail] dfeyer@ttree.ch domain[preferences][description] Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin rhoncus turpis sit amet dolor commodo vel convallis urna condimentum. Sed imperdiet dolor lacinia odio commodo porttitor venenatis eget felis. Ut fermentum, justo et lacinia gravida, tellus augue pretium arcu, et eleifend nulla nulla eget turpis. Aenean ut sem mauris, in luctus neque. Vivamus vehicula rhoncus rhoncus. Ut a purus vel ipsum feugiat ultricies sit amet vitae tellus. Aliquam in neque at elit sagittis bibendum ac non tellus. Maecenas porttitor convallis nisl, ut accumsan mauris elementum sed. Pellentesque sollicitudin nibh at augue laoreet vehicula. Pellentesque non elit nulla, at cursus diam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec nec odio in ante pretium congue. Morbi vestibulum accumsan dui, nec venenatis felis interdum at. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut condimentum eros sagittis neque vulputate egestas. Etiam tincidunt mauris non tellus fringilla hendrerit. domain[preferences][copyrightNotice] (c) 2012, ttree sàrl, etiam tincidunt mauris non tellus fringilla hendrerit domain[preferences][headerImage] summer1b_20070609.jpg Size 585.95 KB (600011 bytes) Content-Type image/jpeg
#7 Updated by Adrian Föder almost 3 years ago
Dominique, is the headerImage
property a TYPO3.Media image? then it hasn't a name
property but a title
property; that's pretty likely the problem here.
#8 Updated by Adrian Föder almost 3 years ago
- Status changed from Needs Feedback to Closed
I'll close it since it wasn't updated for a while and Dominique's issue has been solved; have a look at this maybe: http://wiki.typo3.org/FLOW3_Cookbook#Upload_an_image_as_TYPO3.Media.27s_Image_property
Feel free to reopen this issue if you still experience problems.