Feature #34866
Allow fluently working with PropertyMappingConfiguration
Status:
Resolved
Priority:
Should have
Assignee:
Category:
MVC
Target version:
Start date:
2012-03-15
Due date:
% Done:
100%
Estimated time:
PHP Version:
Has patch:
No
Complexity:
easy
Description
Consider the following use case:
<?php
class SampleController extends \TYPO3\FLOW3\MVC\Controller\ActionController
/**
* this magic method is automatically called prior the appropriate createAction
*/
public function initializeCreateAction() {
$concreteClassName = $this->dummyFindOutConcreteProductProductClassName();
/* @var $this->arguments['product'] \TYPO3\FLOW3\MVC\Controller\Argument (just for this example, please don't use in production code */
$this->arguments['product']->setDataType($concreteClassName);
$this->arguments['product']->getPropertyMappingConfiguration()->setTargetType($intendedRatingClassName);
$this->arguments['product']->getPropertyMappingConfiguration()->setTargetTypeForSubProperty('author', 'TYPO3\Party\Domain\Model\Person');
$this->arguments['product']->getPropertyMappingConfiguration()->allowCreationForSubProperty('author');
$this->arguments['product']->getPropertyMappingConfiguration()->allowCreationForSubProperty('author.name');
}
/**
* Create a new product; expect any concrete product type.
* @param \Acme\Northwind\Domain\Model\AbstractProduct $product So far any kind of product
* @return void
*/
public function createAction(\Acme\Northwind\Domain\Model\AbstractProduct $product) {
}
}
?>
so most possible setter methods of \TYPO3\FLOW3\Property\PropertyMappingConfiguration
, and hence \TYPO3\FLOW3\MVC\Controller\MvcPropertyMappingConfiguration
should return $this
in order to allow a fluent coding, e.g.
$this->arguments['product']->getPropertyMappingConfiguration()
->setTargetType($intendedRatingClassName);
->setTargetTypeForSubProperty('author', 'TYPO3\Party\Domain\Model\Person');
->allowCreationForSubProperty('author');
->allowCreationForSubProperty('author.name');
Updated by Adrian Föder almost 9 years ago
- Status changed from New to Accepted
- Assignee set to Adrian Föder
- Complexity set to easy
Updated by Gerrit Code Review almost 9 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 http://review.typo3.org/9843
Updated by Gerrit Code Review over 8 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9843
Updated by Gerrit Code Review over 8 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9843
Updated by Gerrit Code Review over 8 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9843
Updated by Sebastian Kurfuerst over 8 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100