Feature #30300
Support mapping to subclass by argument
Status: | Resolved | Start date: | 2011-09-26 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Christopher Hlubek | % Done: | 100% |
|
Category: | Property | |||
Target version: | TYPO3 Flow Base Distribution - 1.1 beta 1 | |||
PHP Version: | Complexity: | |||
Has patch: | No |
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
Associated revisions
[FEATURE] Support mapping to specific subtypes by property (__type)
When type hierarchies are used for modeling, it's sometimes necessary
to use a special subclass when creating new entities (e.g. from user
selection). This change enables the use of a special (request)
property "__type" in the source array of a type converter. For security
reasons, this feature must be configured explicitly through a mapping
configuration.
Resolves: #30300
Releases: 1.1
Change-Id: I6d0a9d62789bd8557a848311e1f13f0c094dc51f
History
#1 Updated by Mr. Hudson almost 4 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
#2 Updated by Mr. Hudson almost 4 years ago
Patch set 3 of change I6d0a9d62789bd8557a848311e1f13f0c094dc51f has been pushed to the review server.
It is available at http://review.typo3.org/5355
#3 Updated by Karsten Dambekalns over 3 years ago
- Category set to Property
- Assigned To set to Christopher Hlubek
- Target version set to 1.1
- Has patch set to No
#4 Updated by Mr. Hudson over 3 years ago
Patch set 4 of change I6d0a9d62789bd8557a848311e1f13f0c094dc51f has been pushed to the review server.
It is available at http://review.typo3.org/5355
#5 Updated by Christopher Hlubek over 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 41c21ba3b019c4f6e31760235cff96950c750a01.
#6 Updated by Karsten Dambekalns over 3 years ago
- Target version changed from 1.1 to 1.1 beta 1