44
55use LogicException ;
66
7- abstract class ArrayGridView extends AbstractGridView
7+ abstract class DataSourceGridView extends AbstractGridView
88{
9- protected array $ dataArray ;
9+ protected array $ dataSource ;
1010
1111 public function getRows (): array
1212 {
@@ -17,9 +17,9 @@ public function getRows(): array
1717
1818 protected function sortRows (): void
1919 {
20- $ this ->getDataArray ();
20+ $ this ->getDataSource ();
2121
22- \uasort ($ this ->dataArray , function (array $ a , array $ b ) {
22+ \uasort ($ this ->dataSource , function (array $ a , array $ b ) {
2323 if ($ this ->getSortOrder () === 'ASC ' ) {
2424 return \strcmp ($ a [$ this ->getSortField ()], $ b [$ this ->getSortField ()]);
2525 } else {
@@ -30,23 +30,23 @@ protected function sortRows(): void
3030
3131 protected function getRowsForPage (): array
3232 {
33- return \array_slice ($ this ->getDataArray (), ($ this ->getPageNo () - 1 ) * $ this ->getRowsPerPage (), $ this ->getRowsPerPage ());
33+ return \array_slice ($ this ->getDataSource (), ($ this ->getPageNo () - 1 ) * $ this ->getRowsPerPage (), $ this ->getRowsPerPage ());
3434 }
3535
3636 public function countRows (): int
3737 {
38- return \count ($ this ->getDataArray ());
38+ return \count ($ this ->getDataSource ());
3939 }
4040
41- protected function getDataArray (): array
41+ protected function getDataSource (): array
4242 {
43- if (!isset ($ this ->dataArray )) {
44- $ this ->dataArray = $ this ->loadDataArray ();
43+ if (!isset ($ this ->dataSource )) {
44+ $ this ->dataSource = $ this ->loadDataSource ();
4545 $ this ->applyFilters ();
4646 $ this ->fireInitializedEvent ();
4747 }
4848
49- return $ this ->dataArray ;
49+ return $ this ->dataSource ;
5050 }
5151
5252 protected function applyFilters (): void
@@ -57,11 +57,11 @@ protected function applyFilters(): void
5757 throw new LogicException ("Unknown column ' " . $ key . "' " );
5858 }
5959
60- $ this ->dataArray = \array_filter ($ this ->dataArray , function (array $ row ) use ($ column , $ value ) {
60+ $ this ->dataSource = \array_filter ($ this ->dataSource , function (array $ row ) use ($ column , $ value ) {
6161 return $ column ->getFilter ()->matches ($ value , $ row [$ column ->getID ()]);
6262 });
6363 }
6464 }
6565
66- protected abstract function loadDataArray (): array ;
66+ protected abstract function loadDataSource (): array ;
6767}
0 commit comments