コード例 #1
0
ファイル: DataProcessor.php プロジェクト: retailone/retailone
 /**
  * Process data to output on browser
  *
  * @param bool $object
  * @return array
  */
 public function process($object = false)
 {
     $this->output = [];
     foreach ($this->results as $row) {
         $data = Helper::convertToArray($row);
         $value = $this->addColumns($data, $row);
         $value = $this->editColumns($value, $row);
         $value = $this->setupRowVariables($value, $row);
         $value = $this->removeExcessColumns($value);
         $this->output[] = $object ? $value : $this->flatten($value);
     }
     return $this->escapeColumns($this->output);
 }
コード例 #2
0
ファイル: DataProcessor.php プロジェクト: rikardote/agenda
 /**
  * Process data to output on browser
  *
  * @param bool $object
  * @return array
  */
 public function process($object = false)
 {
     $this->output = [];
     $indexColumn = Config::get('datatables.index_column', 'DT_Row_Index');
     foreach ($this->results as $row) {
         $data = Helper::convertToArray($row);
         $value = $this->addColumns($data, $row);
         $value = $this->editColumns($value, $row);
         $value = $this->setupRowVariables($value, $row);
         $value = $this->removeExcessColumns($value);
         if ($this->includeIndex) {
             $value[$indexColumn] = ++$this->start;
         }
         $this->output[] = $object ? $value : $this->flatten($value);
     }
     return $this->escapeColumns($this->output);
 }
コード例 #3
0
 public function test_convert_to_array()
 {
     $row = new stdClass();
     $row->id = 1;
     $row->name = 'John';
     $row->posts = ['id' => 1, 'title' => 'Demo'];
     $author = new stdClass();
     $author->name = 'Billy';
     $row->author = $author;
     $result = Helper::convertToArray($row);
     $expected = ['id' => 1, 'name' => 'John', 'posts' => ['id' => 1, 'title' => 'Demo'], 'author' => ['name' => 'Billy']];
     $this->assertEquals($expected, $result);
 }