Feature #34866

Allow fluently working with PropertyMappingConfiguration

Added by Adrian Föder over 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
MVC
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');

#1

Updated by Adrian Föder over 9 years ago

  • Status changed from New to Accepted
  • Assignee set to Adrian Föder
  • Complexity set to easy
#2

Updated by Gerrit Code Review over 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

#3

Updated by Gerrit Code Review about 9 years ago

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

#4

Updated by Gerrit Code Review about 9 years ago

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

#5

Updated by Gerrit Code Review about 9 years ago

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

#6

Updated by Sebastian Kurfuerst about 9 years ago

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

Updated by Sebastian Kurfuerst about 9 years ago

  • Target version set to 2.0 beta 1

Also available in: Atom PDF