public function testDataEvent()
 {
     $event = new DataEvent('test', array(array('key' => 'value')));
     $this->assertSame($event->getDataGridName(), 'test');
     $this->assertSame($event->getData(), array(array('key' => 'value')));
     $event->setData(array(array('key2' => 'value2')));
     $this->assertSame(array(array('key2' => 'value2')), $event->getData());
 }
 /**
  * Handles DateTime fields
  * 
  * @param DataEvent $event
  */
 public function onDataReady(DataEvent $event)
 {
     $data = array();
     foreach ($event->getData() as $key => $row) {
         foreach ($row as $field => $value) {
             if ($value instanceof \DateTime) {
                 $value->setTimezone(new \DateTimeZone($this->timezone));
             }
             $data[$key][$field] = $value;
         }
     }
     $event->setData($data);
 }
 /**
  * Handles DateTime fields
  * 
  * @param DataEvent $event
  */
 public function onDataReady(DataEvent $event)
 {
     $data = array();
     foreach ($event->getData() as $key => $row) {
         foreach ($row as $field => $value) {
             if ($value instanceof \DateTime) {
                 $formatter = \IntlDateFormatter::create($this->locale, static::$formats[$this->dateFormat], static::$formats[$this->timeFormat], $this->timezone, IntlDateFormatter::GREGORIAN, $this->format);
                 if (!$formatter) {
                     $formatter = IntlDateFormatter::create('en', static::$formats[$this->dateFormat], static::$formats[$this->timeFormat], $this->timezone, \IntlDateFormatter::GREGORIAN, $this->format);
                 }
                 $value = $formatter->format($value->getTimestamp());
             }
             $data[$key][$field] = $value;
         }
     }
     $event->setData($data);
 }