Last active
March 22, 2017 11:32
-
-
Save Nikdro/d0a18623096cf9cb8ff720263ada046b to your computer and use it in GitHub Desktop.
Neos: This class implements \TYPO3\Flow\Property\PropertyMapper into TypoScript2 / Fusion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace KaufmannDigital\Neos\Base\Eel\Helper; | |
use TYPO3\Flow\Annotations as Flow; | |
use TYPO3\Eel\ProtectedContextAwareInterface; | |
use TYPO3\Flow\Property\PropertyMapper; | |
/** | |
* Class PropertyMapperHelper | |
* | |
* This class implements \TYPO3\Flow\Property\PropertyMapper into TypoScript2 / Fusion | |
* Example usage (Fusion): myObject = ${PropertyMapper.convert(request.arguments.myObject, 'My\Namespace\And\ClassName')} | |
* | |
* @author Niklas Droste <[email protected]> | |
*/ | |
class PropertyMapperHelper implements ProtectedContextAwareInterface | |
{ | |
/** | |
* @Flow\Inject | |
* @var PropertyMapper | |
*/ | |
protected $propertyMapper; | |
/** | |
* @param mixed $source | |
* @param string $targetType | |
* @return mixed | |
*/ | |
public function convert($source, $targetType) | |
{ | |
return $this->propertyMapper->convert($source, $targetType); | |
} | |
/** | |
* @param string $methodName | |
* @return bool | |
*/ | |
public function allowsCallOfMethod($methodName) | |
{ | |
return true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TYPO3: | |
TypoScript: | |
defaultContext: | |
'PropertyMapper': 'Package\Vendor\Eel\Helper\PropertyMapperHelper' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment