Feature #30300
Support mapping to subclass by argument
100%
Description
When type hierarchies are used for modeling, it's necessary to map to a special subclass when creating new entities. This should be possible by a special (request) parameter in the source array of a type converter. For security reasons, this feature must be configured explicitly through a mapping configuration.
Example:
class MyProject\MySpecialUser extends MyProject\User source = { __type: 'MyProject\MySpecialUser', name: 'Foo' } targetType = 'MyProject\User'
In this example, the created type should be an instance of MyProject\MySpecialUser
.
The configuration could be given through a property mapping configuration like this:
class MyObjectController { /** * @return void */ protected function initializeCreateAction() { $argument = $this->arguments->getArgument('newMyObject'); $configuration = $argument->getPropertyMappingConfiguration(); $configuration->allowOverrideTargetType(); } }
If the given type parameter is not an instance of the target type, an exception should be thrown.
Related issues
Updated by Mr. Hudson over 9 years ago
- Status changed from New to Under Review
Patch set 2 of change I6d0a9d62789bd8557a848311e1f13f0c094dc51f has been pushed to the review server.
It is available at http://review.typo3.org/5355
Updated by Mr. Hudson over 9 years ago
Patch set 3 of change I6d0a9d62789bd8557a848311e1f13f0c094dc51f has been pushed to the review server.
It is available at http://review.typo3.org/5355
Updated by Karsten Dambekalns about 9 years ago
- Category set to Property
- Assignee set to Christopher Hlubek
- Target version set to 1.1
- Has patch set to No
Updated by Mr. Hudson about 9 years ago
Patch set 4 of change I6d0a9d62789bd8557a848311e1f13f0c094dc51f has been pushed to the review server.
It is available at http://review.typo3.org/5355
Updated by Christopher Hlubek about 9 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 41c21ba3b019c4f6e31760235cff96950c750a01.