コード例 #1
0
 /**
  * {@inheritdox}
  */
 public function buildContentFromArray(array $data) : TableSectionInterface
 {
     foreach ($data as $rowKey => $rowData) {
         $row = new Row();
         foreach ($rowData as $cellIndex => $cellContent) {
             $cell = $this->newCellInstance();
             $cell->setContent($cellContent);
             $row->addIndexedCell($cellIndex, $cell);
         }
         $this->addIndexedRow($rowKey, $row);
     }
     return $this;
 }
コード例 #2
0
 /**
  * Building the body section of the table, based on the table's configuration
  *
  * @param  null
  *
  * @return TableInterface
  */
 protected function buildBody() : TableInterface
 {
     foreach ($this->modelCollection as $index => $entry) {
         $row = new Row();
         $rowData = [];
         foreach ($this->modelPropertiesAsColumns as $property) {
             $propertyValue = $this->getRowColumnValue($entry, $property) ?? $this->getEmptyColumnPlaceholder();
             $rowData[$property] = $this->getRowColumnValue($entry, $property);
         }
         $row->setContentFromArray($rowData);
         $this->body->addIndexedRow($index, $row);
     }
     return $this;
 }