Skip to content

Commit 37cdba1

Browse files
committed
Added doc block about ArrayAdapter;
1 parent 72e8ed0 commit 37cdba1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,24 @@ class TestController extends \Phalcon\Mvc\Controller {
7272
}
7373
```
7474

75+
### Controller (using Array):
76+
```php
77+
<?php
78+
use \DataTables\DataTable;
79+
80+
class TestController extends \Phalcon\Mvc\Controller {
81+
public function indexAction() {
82+
if ($this->request->isAjax()) {
83+
$array = $this->modelsManager->createQuery("SELECT * FROM \Example\Models\User")
84+
->execute()->toArray();
85+
86+
$dataTables = new DataTable();
87+
$dataTables->fromArray($array)->sendResponse();
88+
}
89+
}
90+
}
91+
```
92+
7593
### Model:
7694
```php
7795
<?php

0 commit comments

Comments
 (0)