main/core/Form/DataTransformer/DateRangeToTextTransformer.php
public function reverseTransform($string)
    {
        $startDate = time();
        $endDate = time();
        $separator = $this->translator->trans('date_range.separator', array(), 'platform');

        if ($string != null) {
            $array = explode(' '.$separator.' ', $string);

            if (array_key_exists(0, $array)) {
                $dateFormat = $this->translator->trans('date_range.format', array(), 'platform');
                $startDate = $endDate = \DateTime::createFromFormat($dateFormat, $array[0])->getTimestamp();

                if (array_key_exists(1, $array)) {
                    $endDate = \DateTime::createFromFormat($dateFormat, $array[1])->getTimestamp();
                }
            }

            return array($startDate, $endDate);
        }
    }
public function reverseTransform($string)
    {
        $startDate = time();
        $endDate = time();
        $separator = $this->translator->trans('date_range.separator', array(), 'platform');

        if ($string != null) {
            $array = explode(' '.$separator.' ', $string);

            if (array_key_exists(0, $array)) {
                $dateFormat = $this->translator->trans('date_range.format', array(), 'platform');
                $startDate = $endDate = \DateTime::createFromFormat($dateFormat, $array[0])->getTimestamp();

                if (array_key_exists(1, $array)) {
                    $endDate = \DateTime::createFromFormat($dateFormat, $array[1])->getTimestamp();
                }
            }

            return array($startDate, $endDate);
        }
    }
public function reverseTransform ( $ string ) { $ startDate = time ( ) ; $ endDate = time ( ) ; $ separator = $ this -> translator -> trans ( 'date_range.separator' , array ( ) , 'platform' ) ; if ( $ string != null ) { $ array = explode ( ' ' . $ separator . ' ' , $ string ) ; if ( array_key_exists ( 0 , $ array ) ) { $ dateFormat = $ this -> translator -> trans ( 'date_range.format' , array ( ) , 'platform' ) ; $ startDate = $ endDate = \ DateTime :: createFromFormat ( $ dateFormat , $ array [ 0 ] ) -> getTimestamp ( ) ; if ( array_key_exists ( 1 , $ array ) ) { $ endDate = \ DateTime :: createFromFormat ( $ dateFormat , $ array [ 1 ] ) -> getTimestamp ( ) ; } } return array ( $ startDate , $ endDate ) ; } }
Transforms a string to an array of 2 dates.

@param string $string

@return array of strings (names for tags)
Transforms a string to an array of 2 dates .