/**
  * {@inheritdoc}
  */
 public function build(array $options)
 {
     $definition = parent::build($options);
     foreach ($options['index']['columns'] as $name => $settings) {
         $column = new Column();
         $column->setName($name);
         if (null === $settings['title']) {
             $column->setTitle($this->titlize($name));
         } else {
             $column->setTitle($settings['title']);
         }
         if (is_bool($settings['sortable'])) {
             $column->setSortable($settings['sortable']);
         }
         if (null === $settings['path'] || true === $settings['path']) {
             $column->setPath($name);
         } else {
             $column->setPath($settings['path']);
         }
         $column->setType($settings['type']);
         $definition->addColumn($column);
     }
     if (null !== $options['index']['sort']['column']) {
         $this->setSortColumn($definition, $options['index']['sort']['column'], $options['index']['sort']['direction']);
     }
     return $definition;
 }
 /**
  * {@inheritdoc}
  */
 public function build(array $options)
 {
     $definition = parent::build($options);
     // TODO: add columns
     $em = $this->doctrine->getManagerForClass($options['entity']);
     $metadata = $em->getClassMetadata($options['entity']);
     //var_dump($metadata);
     //var_dump($options);
     foreach ($metadata->getFieldNames() as $field) {
         $type = $metadata->getTypeOfField($field);
         $column = new Column();
         $column->setName($field);
         $column->setTitle($this->titlize($field));
         $column->setPath($field);
         if (in_array($type, ['string', 'integer', 'smallint', 'bigint', 'decimal', 'float'])) {
             $column->setType('text');
             $definition->addColumn($column);
         }
         if (in_array($type, ['date', 'time', 'datetime', 'datetimetz'])) {
             $column->setType($type);
             $definition->addColumn($column);
         }
         if ($type === 'boolean') {
             $column->setType('bool');
             $definition->addColumn($column);
         }
     }
     if (null !== $options['index']['sort']['column']) {
         $this->setSortColumn($definition, $options['index']['sort']['column'], $options['index']['sort']['direction']);
     }
     return $definition;
 }