/**
  * {@inheritdoc}
  */
 public function getData(RequestInterface $request)
 {
     $data = new \SplDoublyLinkedList();
     $source = array_slice($this->source, $request->getLimit() * ($request->getPage() - 1), $request->getLimit());
     foreach ($source as $rowData) {
         $row = new Row();
         foreach ($rowData as $cellData) {
             $row->appendCell(new Cell($cellData));
         }
         $data[] = $row;
     }
     return $data;
 }
 /**
  * {@inheritdoc}
  */
 public function process($source)
 {
     $fields = $this->getFields();
     $row = new Row();
     foreach ($this->schemaProvider->getSchema()->getMetadataProperties() as $name) {
         $metaValue = $this->accessor->getValue($source, $name);
         $row->setMetadataProperty($name, $metaValue);
     }
     foreach ($fields as $property => $field) {
         $value = $this->accessor->getValue($source, $property);
         $row->appendCell(new Cell($value, $field));
     }
     return $row;
 }
Exemple #3
0
 /**
  * Get url if the cell is a link
  * 
  * @return string
  */
 public function getLink()
 {
     $link = $this->field->getCellLink();
     if ($link === null) {
         return;
     }
     return preg_replace_callback('~\\{([^}]+)\\}~', function ($matches) {
         if ($this->row === null) {
             throw new \LogicException('Cell doesn\'t belongs to a row');
         }
         return $this->row->getMetadataProperty($matches[1]);
     }, $link);
 }