I think that the transformer himself has nothing to do with the "properties", it just handle transformation from a data structure to another data structure. You just have to handle the new data structure on your code base.
The transformer himself might look like this :
class DateRangeArrayToDateRangeStringTransformer implements DataTransformerInterface
{
/**
* Transforms an array of \DateTime instances to a string of dates.
*
* @param array|null $dates
* @return string
*/
public function transform($dates)
{
if (null === $dates) {
return '';
}
$datesStr = $dates['from']->format('Y-m-d').','.$dates['to']->format('Y-m-d');
return $datesStr;
}
/**
* Transforms a string of dates to an array of \DateTime instances.
*
* @param string $datesStr
* @return array
*/
public function reverseTransform($datesStr)
{
$dates = array();
$datesStrParts = explode(',', $datesStr);
return array(
'from' => new \DateTime($datesStrParts[1]),
'to' => new \DateTime($datesStrParts[2])
);
}
}