Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getSchema()
 {
     $colsNumber = 0;
     foreach ($this->source as $row) {
         $count = count($row);
         if ($count > $colsNumber) {
             $colsNumber = $count;
         }
     }
     $schema = new Schema();
     if ($colsNumber === 0) {
         return $schema;
     }
     $colSize = (int) round(100 / $colsNumber);
     for ($i = 0; $i < $colsNumber; ++$i) {
         $field = new Field($i);
         $field->setWidth($colSize);
         $schema->addField($field);
     }
     return $schema;
 }
 /**
  * Apply annotation to field
  * 
  * @param Field            $field
  * @param ColumnAnnotation $annotation
  */
 protected function applyAnnotation(Field $field, ColumnAnnotation $annotation)
 {
     $field->setTitle($annotation->title);
     $field->setType($annotation->type);
     $field->setWidth($annotation->width);
     $field->setProperty($annotation->property);
     $field->setOrderable($annotation->orderable);
     $field->setOrderBy($annotation->orderBy);
     $field->setSearchable($annotation->searchable);
     $field->setSearchBy($annotation->searchBy);
     $field->setGloballySearchable($annotation->globalSearch);
     $field->setPriority($annotation->priority);
 }