コード例 #1
0
 protected function assignColumns(Builder $builder, Collection $collection)
 {
     $columns = $this->findViewColumns($builder, $collection);
     $columnList = new ColumnList();
     $accessor = new DottedObjectAccess();
     $rootModel = $builder->model();
     foreach ($columns as $columnName) {
         $column = Column::create()->setAccessor($columnName, $accessor)->setTitle($this->namer->keyTitle($rootModel, $columnName));
         $columnList->push($column);
         if ($type = $this->types->keyType($rootModel, $columnName)) {
             $column->setValueFormatter($type);
         }
     }
     $collection->setColumns($columnList);
 }
コード例 #2
0
 public function setColumns($columns)
 {
     if ($columns instanceof ColumnList) {
         $this->columns = $columns;
     } else {
         $this->columns = ColumnList::fromArray($columns);
     }
     return $this;
 }