Bug #36734

Transient properties cannot be property mapped

Added by Alexander Berl over 8 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Should have
Category:
Property
Target version:
-
Start date:
2012-04-30
Due date:
% Done:

100%

Estimated time:
PHP Version:
5.3
Has patch:
No
Complexity:

Description

When creating an object containing transient properties through a webform an exception is thrown that the property is not found within the object.

Example

Model

/**
 * A Baz
 *
 * @FLOW3\Entity
 */
class Baz {

    /**
     * The password
     * @var string
     * @FLOW3\Transient
     */
    protected $password;
...
}

Form

    <f:form action="create" name="baz" object="{baz}">
        Password: <f:form.textfield property="password" /><br />
        <f:form.submit value="submit" />
    </f:form>

After submitting the form the following exception is thrown:

TYPO3\FLOW3\Property\Exception\InvalidTargetException thrown in file TYPO3_FLOW3_Property_TypeConverter_PersistentObjectConverter_Original.php

Property "password" was not found in target object of type "Foo\Bar\Domain\Model\Baz".
20 TYPO3\FLOW3\Property\TypeConverter\PersistentObjectConverter_Original::getTypeOfChildProperty("Foo\Bar\Domain\Model\Baz", "password", TYPO3\FLOW3\Mvc\Controller\MvcPropertyMappingConfiguration)

19 TYPO3\FLOW3\Property\PropertyMapper_Original::doMapping(array, "Foo\Bar\Domain\Model\Baz", TYPO3\FLOW3\Mvc\Controller\MvcPropertyMappingConfiguration, array)

18 TYPO3\FLOW3\Property\PropertyMapper_Original::convert(array, "Foo\Bar\Domain\Model\Baz", 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()

The problem here is, that the property is skipped in reflection due to the Transient annotation (see ReflectionService->addPropertiesToClassSchema) and therefore also cannot be property mapped.

see http://lists.typo3.org/pipermail/flow3-general/2012-April/002285.html

#1

Updated by Karsten Dambekalns over 8 years ago

  • Status changed from New to Accepted
  • Assignee set to Karsten Dambekalns
  • Priority changed from -- undefined -- to Should have
#2

Updated by Alexander Berl almost 8 years ago

Just some research on the matter:
@Transient is currently only really used in the ReflectionService/classSchema, i.e. all Transient properties are not regarded for the classSchema.
The classSchemas properties in turn are only relevant for:
- the generic persistence in the DataMapper (only schema properties are used for reconstitution)
- for finding property annotations in the doctrine persistence, to quickly skip properties not part of classSchema
- in the property mapping PersistentObjectConverter where only classSchema properties are data mapped
- in the validation UniqueEntityValidator when (custom) identity properties are not part of the classSchema

I think a good solution would be to add @Transient properties to the classSchema, but tag them as transient there, so the checks in generic persistence/doctrine(/validation?) can still skip those properties.

I'm gonna try and provide a changeset when I find time.

#3

Updated by Gerrit Code Review almost 8 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19862

#4

Updated by Gerrit Code Review almost 8 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19862

#5

Updated by Gerrit Code Review almost 8 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19862

#6

Updated by Gerrit Code Review over 7 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19862

#7

Updated by Gerrit Code Review over 7 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19862

#8

Updated by Gerrit Code Review over 6 years ago

Patch set 6 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/19862

#9

Updated by Gerrit Code Review over 6 years ago

Patch set 7 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/19862

#10

Updated by Gerrit Code Review over 6 years ago

Patch set 8 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at http://review.typo3.org/19862

#11

Updated by Gerrit Code Review over 6 years ago

Patch set 9 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at http://review.typo3.org/19862

#12

Updated by Gerrit Code Review over 6 years ago

Patch set 10 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at http://review.typo3.org/19862

#13

Updated by Alexander Berl over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF