Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function render($data, array $options)
 {
     $dateTime = $this->getValue($data, $options);
     if ($dateTime === null) {
         return;
     }
     if (!$dateTime instanceof \DateTimeInterface) {
         throw new InvalidTypeException(sprintf('The "%s" %s column type expects a "\\DateTimeInterface" value, got "%s".', $options['column']->getName(), $this->getName(), is_object($dateTime) ? get_class($dateTime) : gettype($dateTime)));
     }
     return $this->formatter->format($dateTime, $options);
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function render($data, array $options)
 {
     $number = $this->getValue($data, $options);
     if ($number === null) {
         return;
     }
     if (!is_numeric($number)) {
         throw new InvalidTypeException(sprintf('The "%s" %s column type expects a numeric value, got "%s".', $options['column']->getName(), $this->getName(), is_object($number) ? get_class($number) : gettype($number)));
     }
     return $this->formatter->format($number, $options);
 }