Complex classes like Grid often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Grid, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 50 | 1 | class Grid extends Components\Container |
|
| 51 | 1 | { |
|
| 52 | /***** DEFAULTS ****/ |
||
| 53 | const BUTTONS = 'buttons'; |
||
| 54 | |||
| 55 | const CLIENT_SIDE_OPTIONS = 'grido-options'; |
||
| 56 | |||
| 57 | /** @var int @persistent */ |
||
| 58 | public $page = 1; |
||
| 59 | |||
| 60 | /** @var int @persistent */ |
||
| 61 | public $perPage; |
||
| 62 | |||
| 63 | /** @var array @persistent */ |
||
| 64 | public $sort = []; |
||
| 65 | |||
| 66 | 1 | /** @var array @persistent */ |
|
| 67 | public $filter = []; |
||
| 68 | |||
| 69 | /** @var array event on all grid's components registered */ |
||
| 70 | public $onRegistered; |
||
| 71 | |||
| 72 | /** @var array event on render */ |
||
| 73 | public $onRender; |
||
| 74 | |||
| 75 | /** @var array event for modifying data */ |
||
| 76 | public $onFetchData; |
||
| 77 | |||
| 78 | /** @var callback returns tr html element; function($row, Html $tr) */ |
||
| 79 | protected $rowCallback; |
||
| 80 | |||
| 81 | /** @var \Nette\Utils\Html */ |
||
| 82 | protected $tablePrototype; |
||
| 83 | |||
| 84 | /** @var bool */ |
||
| 85 | protected $rememberState = FALSE; |
||
| 86 | |||
| 87 | /** @var string */ |
||
| 88 | protected $rememberStateSectionName; |
||
| 89 | |||
| 90 | /** @var string */ |
||
| 91 | protected $primaryKey = 'id'; |
||
| 92 | |||
| 93 | /** @var string */ |
||
| 94 | protected $filterRenderType; |
||
| 95 | |||
| 96 | /** @var array */ |
||
| 97 | protected $perPageList = [10, 20, 30, 50, 100]; |
||
| 98 | |||
| 99 | /** @var int */ |
||
| 100 | protected $defaultPerPage = 20; |
||
| 101 | |||
| 102 | /** @var array */ |
||
| 103 | protected $defaultFilter = []; |
||
| 104 | |||
| 105 | /** @var array */ |
||
| 106 | protected $defaultSort = []; |
||
| 107 | |||
| 108 | /** @var DataSources\IDataSource */ |
||
| 109 | protected $model; |
||
| 110 | |||
| 111 | /** @var int total count of items */ |
||
| 112 | protected $count; |
||
| 113 | |||
| 114 | /** @var mixed */ |
||
| 115 | protected $data; |
||
| 116 | |||
| 117 | /** @var Paginator */ |
||
| 118 | protected $paginator; |
||
| 119 | 1 | ||
| 120 | /** @var \Nette\Localization\ITranslator */ |
||
| 121 | protected $translator; |
||
| 122 | |||
| 123 | /** @var PropertyAccessor */ |
||
| 124 | protected $propertyAccessor; |
||
| 125 | |||
| 126 | /** @var bool */ |
||
| 127 | protected $strictMode = TRUE; |
||
| 128 | |||
| 129 | /** @var array */ |
||
| 130 | protected $options = [ |
||
| 131 | self::CLIENT_SIDE_OPTIONS => [] |
||
| 132 | ]; |
||
| 133 | |||
| 134 | /** @var Customization */ |
||
| 135 | 1 | protected $customization; |
|
| 136 | |||
| 137 | /** |
||
| 138 | * Sets a model that implements the interface Grido\DataSources\IDataSource or data-source object. |
||
| 139 | * @param mixed $model |
||
| 140 | * @param bool $forceWrapper |
||
| 141 | * @throws Exception |
||
| 142 | * @return Grid |
||
| 143 | */ |
||
| 144 | public function setModel($model, $forceWrapper = FALSE) |
||
| 145 | { |
||
| 146 | 1 | $this->model = $model instanceof DataSources\IDataSource && $forceWrapper === FALSE |
|
| 147 | 1 | ? $model |
|
| 148 | 1 | : new DataSources\Model($model); |
|
| 149 | |||
| 150 | 1 | return $this; |
|
| 151 | } |
||
| 152 | |||
| 153 | 1 | /** |
|
| 154 | * Sets the default number of items per page. |
||
| 155 | * @param int $perPage |
||
| 156 | * @return Grid |
||
| 157 | */ |
||
| 158 | public function setDefaultPerPage($perPage) |
||
| 159 | { |
||
| 160 | 1 | $perPage = (int) $perPage; |
|
| 161 | 1 | $this->defaultPerPage = $perPage; |
|
| 162 | |||
| 163 | 1 | if (!in_array($perPage, $this->perPageList)) { |
|
| 164 | 1 | $this->perPageList[] = $perPage; |
|
| 165 | 1 | sort($this->perPageList); |
|
| 166 | 1 | } |
|
| 167 | |||
| 168 | 1 | return $this; |
|
| 169 | } |
||
| 170 | |||
| 171 | /** |
||
| 172 | * Sets default filtering. |
||
| 173 | * @param array $filter |
||
| 174 | * @return Grid |
||
| 175 | */ |
||
| 176 | public function setDefaultFilter(array $filter) |
||
| 177 | { |
||
| 178 | 1 | $this->defaultFilter = array_merge($this->defaultFilter, $filter); |
|
| 179 | 1 | return $this; |
|
| 180 | } |
||
| 181 | |||
| 182 | /** |
||
| 183 | * Sets default sorting. |
||
| 184 | * @param array $sort |
||
| 185 | * @return Grid |
||
| 186 | * @throws Exception |
||
| 187 | 1 | */ |
|
| 188 | public function setDefaultSort(array $sort) |
||
| 189 | { |
||
| 190 | 1 | static $replace = ['asc' => Column::ORDER_ASC, 'desc' => Column::ORDER_DESC]; |
|
| 191 | |||
| 192 | 1 | foreach ($sort as $column => $dir) { |
|
| 193 | 1 | $dir = strtr(strtolower($dir), $replace); |
|
| 194 | 1 | if (!in_array($dir, $replace)) { |
|
| 195 | 1 | throw new Exception("Dir '$dir' for column '$column' is not allowed."); |
|
| 196 | } |
||
| 197 | |||
| 198 | 1 | $this->defaultSort[$column] = $dir; |
|
| 199 | 1 | } |
|
| 200 | |||
| 201 | 1 | return $this; |
|
| 202 | } |
||
| 203 | |||
| 204 | /** |
||
| 205 | * Sets items to per-page select. |
||
| 206 | * @param array $perPageList |
||
| 207 | 1 | * @return Grid |
|
| 208 | 1 | */ |
|
| 209 | public function setPerPageList(array $perPageList) |
||
| 210 | { |
||
| 211 | 1 | $this->perPageList = $perPageList; |
|
| 212 | |||
| 213 | 1 | if ($this->hasFilters(FALSE) || $this->hasOperation(FALSE)) { |
|
| 214 | 1 | $this['form']['count']->setItems($this->getItemsForCountSelect()); |
|
| 215 | 1 | } |
|
| 216 | |||
| 217 | 1 | return $this; |
|
| 218 | } |
||
| 219 | |||
| 220 | /** |
||
| 221 | * Sets translator. |
||
| 222 | * @param \Nette\Localization\ITranslator $translator |
||
| 223 | * @return Grid |
||
| 224 | */ |
||
| 225 | public function setTranslator(\Nette\Localization\ITranslator $translator) |
||
| 226 | { |
||
| 227 | 1 | $this->translator = $translator; |
|
| 228 | 1 | return $this; |
|
| 229 | } |
||
| 230 | |||
| 231 | /** |
||
| 232 | * Sets type of filter rendering. |
||
| 233 | * Defaults inner (Filter::RENDER_INNER) if column does not exist then outer filter (Filter::RENDER_OUTER). |
||
| 234 | * @param string $type |
||
| 235 | 1 | * @throws Exception |
|
| 236 | * @return Grid |
||
| 237 | */ |
||
| 238 | public function setFilterRenderType($type) |
||
| 239 | { |
||
| 240 | 1 | $type = strtolower($type); |
|
| 241 | 1 | if (!in_array($type, [Filter::RENDER_INNER, Filter::RENDER_OUTER])) { |
|
| 242 | 1 | throw new Exception('Type must be Filter::RENDER_INNER or Filter::RENDER_OUTER.'); |
|
| 243 | } |
||
| 244 | |||
| 245 | 1 | $this->filterRenderType = $type; |
|
| 246 | 1 | return $this; |
|
| 247 | } |
||
| 248 | |||
| 249 | /** |
||
| 250 | * Sets custom paginator. |
||
| 251 | * @param Paginator $paginator |
||
| 252 | * @return Grid |
||
| 253 | */ |
||
| 254 | public function setPaginator(Paginator $paginator) |
||
| 255 | { |
||
| 256 | 1 | $this->paginator = $paginator; |
|
| 257 | 1 | return $this; |
|
| 258 | } |
||
| 259 | |||
| 260 | /** |
||
| 261 | * Sets grid primary key. |
||
| 262 | * Defaults is "id". |
||
| 263 | * @param string $key |
||
| 264 | * @return Grid |
||
| 265 | */ |
||
| 266 | public function setPrimaryKey($key) |
||
| 267 | { |
||
| 268 | 1 | $this->primaryKey = $key; |
|
| 269 | 1 | return $this; |
|
| 270 | } |
||
| 271 | |||
| 272 | /** |
||
| 273 | * Sets file name of custom template. |
||
| 274 | * @param string $file |
||
| 275 | * @return Grid |
||
| 276 | */ |
||
| 277 | public function setTemplateFile($file) |
||
| 278 | { |
||
| 279 | 1 | $this->onRender[] = function() use ($file) { |
|
| 280 | 1 | $this->template->gridoTemplate = $this->getTemplate()->getFile(); |
|
|
|
|||
| 281 | 1 | $this->getTemplate()->setFile($file); |
|
| 282 | 1 | }; |
|
| 283 | 1 | ||
| 284 | 1 | return $this; |
|
| 285 | } |
||
| 286 | |||
| 287 | /** |
||
| 288 | * Sets saving state to session. |
||
| 289 | * @param bool $state |
||
| 290 | * @param string $sectionName |
||
| 291 | * @return Grid |
||
| 292 | */ |
||
| 293 | public function setRememberState($state = TRUE, $sectionName = NULL) |
||
| 294 | { |
||
| 295 | 1 | $this->getPresenter(); //component must be attached to presenter |
|
| 296 | 1 | $this->getRememberSession(TRUE); //start session if not |
|
| 297 | 1 | $this->rememberState = (bool) $state; |
|
| 298 | 1 | $this->rememberStateSectionName = $sectionName; |
|
| 299 | |||
| 300 | 1 | return $this; |
|
| 301 | } |
||
| 302 | |||
| 303 | /** |
||
| 304 | * Sets callback for customizing tr html object. |
||
| 305 | * Callback returns tr html element; function($row, Html $tr). |
||
| 306 | * @param $callback |
||
| 307 | * @return Grid |
||
| 308 | */ |
||
| 309 | public function setRowCallback($callback) |
||
| 310 | { |
||
| 311 | 1 | $this->rowCallback = $callback; |
|
| 312 | 1 | return $this; |
|
| 313 | } |
||
| 314 | |||
| 315 | /** |
||
| 316 | * Sets client-side options. |
||
| 317 | * @param array $options |
||
| 318 | * @return Grid |
||
| 319 | */ |
||
| 320 | public function setClientSideOptions(array $options) |
||
| 321 | { |
||
| 322 | 1 | $this->options[self::CLIENT_SIDE_OPTIONS] = $options; |
|
| 323 | 1 | return $this; |
|
| 324 | } |
||
| 325 | |||
| 326 | /** |
||
| 327 | * Determines whether any user error will cause a notice. |
||
| 328 | * @param bool $mode |
||
| 329 | * @return \Grido\Grid |
||
| 330 | */ |
||
| 331 | public function setStrictMode($mode) |
||
| 332 | { |
||
| 333 | 1 | $this->strictMode = (bool) $mode; |
|
| 334 | 1 | return $this; |
|
| 335 | } |
||
| 336 | |||
| 337 | /** |
||
| 338 | * @param \Grido\Customization $customization |
||
| 339 | */ |
||
| 340 | public function setCustomization(Customization $customization) |
||
| 344 | |||
| 345 | /**********************************************************************************************/ |
||
| 346 | |||
| 347 | /** |
||
| 348 | * Returns total count of data. |
||
| 349 | * @return int |
||
| 350 | */ |
||
| 351 | public function getCount() |
||
| 352 | { |
||
| 353 | 1 | if ($this->count === NULL) { |
|
| 354 | 1 | $this->count = $this->getModel()->getCount(); |
|
| 355 | 1 | } |
|
| 356 | |||
| 357 | 1 | return $this->count; |
|
| 358 | } |
||
| 359 | |||
| 360 | /** |
||
| 361 | * Returns default per page. |
||
| 362 | * @return int |
||
| 363 | */ |
||
| 364 | public function getDefaultPerPage() |
||
| 365 | { |
||
| 366 | 1 | if (!in_array($this->defaultPerPage, $this->perPageList)) { |
|
| 367 | 1 | $this->defaultPerPage = $this->perPageList[0]; |
|
| 368 | 1 | } |
|
| 369 | |||
| 370 | 1 | return $this->defaultPerPage; |
|
| 371 | } |
||
| 372 | |||
| 373 | /** |
||
| 374 | * Returns default filter. |
||
| 375 | * @return array |
||
| 376 | */ |
||
| 377 | public function getDefaultFilter() |
||
| 381 | |||
| 382 | /** |
||
| 383 | * Returns default sort. |
||
| 384 | * @return array |
||
| 385 | */ |
||
| 386 | public function getDefaultSort() |
||
| 390 | |||
| 391 | /** |
||
| 392 | * Returns list of possible items per page. |
||
| 393 | * @return array |
||
| 394 | */ |
||
| 395 | public function getPerPageList() |
||
| 399 | |||
| 400 | /** |
||
| 401 | * Returns primary key. |
||
| 402 | * @return string |
||
| 403 | */ |
||
| 404 | public function getPrimaryKey() |
||
| 408 | |||
| 409 | /** |
||
| 410 | * Returns remember state. |
||
| 411 | * @return bool |
||
| 412 | */ |
||
| 413 | public function getRememberState() |
||
| 417 | |||
| 418 | /** |
||
| 419 | * Returns row callback. |
||
| 420 | * @return callback |
||
| 421 | */ |
||
| 422 | public function getRowCallback() |
||
| 426 | |||
| 427 | /** |
||
| 428 | * Returns items per page. |
||
| 429 | * @return int |
||
| 430 | */ |
||
| 431 | public function getPerPage() |
||
| 432 | { |
||
| 433 | 1 | return $this->perPage === NULL |
|
| 434 | 1 | ? $this->getDefaultPerPage() |
|
| 435 | 1 | : $this->perPage; |
|
| 436 | } |
||
| 437 | |||
| 438 | /** |
||
| 439 | * Returns actual filter values. |
||
| 440 | * @param string $key |
||
| 441 | * @return mixed |
||
| 442 | */ |
||
| 443 | public function getActualFilter($key = NULL) |
||
| 448 | |||
| 449 | /** |
||
| 450 | * Returns fetched data. |
||
| 451 | * @param bool $applyPaging |
||
| 452 | * @param bool $useCache |
||
| 453 | * @param bool $fetch |
||
| 454 | * @throws Exception |
||
| 455 | * @return array|DataSources\IDataSource|\Nette\Database\Table\Selection |
||
| 456 | */ |
||
| 457 | public function getData($applyPaging = TRUE, $useCache = TRUE, $fetch = TRUE) |
||
| 458 | { |
||
| 459 | 1 | if ($this->getModel() === NULL) { |
|
| 460 | 1 | throw new Exception('Model cannot be empty, please use method $grid->setModel().'); |
|
| 461 | } |
||
| 462 | |||
| 463 | 1 | $data = $this->data; |
|
| 464 | 1 | if ($data === NULL || $useCache === FALSE) { |
|
| 465 | 1 | $this->applyFiltering(); |
|
| 466 | 1 | $this->applySorting(); |
|
| 467 | |||
| 468 | 1 | if ($applyPaging) { |
|
| 469 | 1 | $this->applyPaging(); |
|
| 470 | 1 | } |
|
| 471 | |||
| 472 | 1 | if ($fetch === FALSE) { |
|
| 473 | 1 | return $this->getModel(); |
|
| 474 | } |
||
| 475 | |||
| 476 | 1 | $data = $this->getModel()->getData(); |
|
| 477 | |||
| 478 | 1 | if ($useCache === TRUE) { |
|
| 479 | 1 | $this->data = $data; |
|
| 480 | 1 | } |
|
| 481 | |||
| 482 | 1 | if ($applyPaging && !empty($data) && !in_array($this->page, range(1, $this->getPaginator()->pageCount))) { |
|
| 483 | 1 | $this->__triggerUserNotice("Page is out of range."); |
|
| 484 | 1 | $this->page = 1; |
|
| 485 | 1 | } |
|
| 486 | |||
| 487 | 1 | if (!empty($this->onFetchData)) { |
|
| 488 | $this->onFetchData($this); |
||
| 489 | } |
||
| 490 | 1 | } |
|
| 491 | |||
| 492 | 1 | return $data; |
|
| 493 | } |
||
| 494 | |||
| 495 | /** |
||
| 496 | * Returns translator. |
||
| 497 | * @return Translations\FileTranslator |
||
| 498 | */ |
||
| 499 | public function getTranslator() |
||
| 500 | { |
||
| 501 | 1 | if ($this->translator === NULL) { |
|
| 502 | 1 | $this->setTranslator(new Translations\FileTranslator); |
|
| 503 | 1 | } |
|
| 504 | |||
| 505 | 1 | return $this->translator; |
|
| 506 | } |
||
| 507 | |||
| 508 | /** |
||
| 509 | * Returns remember session for set expiration, etc. |
||
| 510 | * @param bool $forceStart - if TRUE, session will be started if not |
||
| 511 | * @return \Nette\Http\SessionSection|NULL |
||
| 512 | */ |
||
| 513 | public function getRememberSession($forceStart = FALSE) |
||
| 514 | { |
||
| 515 | 1 | $presenter = $this->getPresenter(); |
|
| 516 | 1 | $session = $presenter->getSession(); |
|
| 517 | |||
| 518 | 1 | if (!$session->isStarted() && $forceStart) { |
|
| 519 | 1 | $session->start(); |
|
| 520 | 1 | } |
|
| 521 | |||
| 522 | 1 | return $session->isStarted() |
|
| 523 | 1 | ? ($session->getSection($this->rememberStateSectionName ?: ($presenter->name . ':' . $this->getUniqueId()))) |
|
| 524 | 1 | : NULL; |
|
| 525 | } |
||
| 526 | |||
| 527 | /** |
||
| 528 | * Returns table html element of grid. |
||
| 529 | * @return \Nette\Utils\Html |
||
| 530 | */ |
||
| 531 | public function getTablePrototype() |
||
| 532 | { |
||
| 533 | 1 | if ($this->tablePrototype === NULL) { |
|
| 534 | 1 | $this->tablePrototype = \Nette\Utils\Html::el('table'); |
|
| 535 | 1 | $this->tablePrototype->id($this->getName()); |
|
| 536 | 1 | } |
|
| 537 | |||
| 538 | 1 | return $this->tablePrototype; |
|
| 539 | } |
||
| 540 | |||
| 541 | /** |
||
| 542 | * @return string |
||
| 543 | * @internal |
||
| 544 | */ |
||
| 545 | public function getFilterRenderType() |
||
| 546 | { |
||
| 547 | 1 | if ($this->filterRenderType !== NULL) { |
|
| 548 | 1 | return $this->filterRenderType; |
|
| 549 | } |
||
| 550 | |||
| 551 | 1 | $this->filterRenderType = Filter::RENDER_OUTER; |
|
| 552 | 1 | if ($this->hasColumns() && $this->hasFilters() && $this->hasActions()) { |
|
| 553 | 1 | $this->filterRenderType = Filter::RENDER_INNER; |
|
| 554 | |||
| 555 | 1 | $filters = $this[Filter::ID]->getComponents(); |
|
| 556 | 1 | foreach ($filters as $filter) { |
|
| 557 | 1 | if (!$this[Column::ID]->getComponent($filter->name, FALSE)) { |
|
| 558 | 1 | $this->filterRenderType = Filter::RENDER_OUTER; |
|
| 559 | 1 | break; |
|
| 560 | } |
||
| 561 | 1 | } |
|
| 562 | 1 | } |
|
| 563 | |||
| 564 | 1 | return $this->filterRenderType; |
|
| 565 | } |
||
| 566 | |||
| 567 | /** |
||
| 568 | * @return DataSources\IDataSource |
||
| 569 | */ |
||
| 570 | public function getModel() |
||
| 574 | |||
| 575 | /** |
||
| 576 | * @return Paginator |
||
| 577 | * @internal |
||
| 578 | */ |
||
| 579 | public function getPaginator() |
||
| 580 | { |
||
| 581 | 1 | if ($this->paginator === NULL) { |
|
| 582 | 1 | $this->paginator = new Paginator; |
|
| 583 | 1 | $this->paginator->setItemsPerPage($this->getPerPage()) |
|
| 584 | 1 | ->setGrid($this); |
|
| 585 | 1 | } |
|
| 586 | |||
| 587 | 1 | return $this->paginator; |
|
| 588 | } |
||
| 589 | |||
| 590 | /** |
||
| 591 | * A simple wrapper around symfony/property-access with Nette Database dot notation support. |
||
| 592 | * @param array|object $object |
||
| 593 | * @param string $name |
||
| 594 | * @return mixed |
||
| 595 | * @internal |
||
| 596 | */ |
||
| 597 | public function getProperty($object, $name) |
||
| 598 | { |
||
| 599 | 1 | if ($object instanceof \Nette\Database\Table\IRow && \Nette\Utils\Strings::contains($name, '.')) { |
|
| 600 | 1 | $parts = explode('.', $name); |
|
| 601 | 1 | foreach ($parts as $item) { |
|
| 602 | 1 | if (is_object($object)) { |
|
| 603 | 1 | $object = $object->$item; |
|
| 604 | 1 | } |
|
| 605 | 1 | } |
|
| 606 | |||
| 607 | 1 | return $object; |
|
| 608 | } |
||
| 609 | |||
| 610 | 1 | if (is_array($object)) { |
|
| 611 | 1 | $name = "[$name]"; |
|
| 612 | 1 | } |
|
| 613 | |||
| 614 | 1 | if (!$this->getPropertyAccessor()->isReadable($object, $name)) { |
|
| 615 | 1 | return NULL; |
|
| 616 | } else { |
||
| 617 | 1 | return $this->getPropertyAccessor()->getValue($object, $name); |
|
| 618 | } |
||
| 619 | } |
||
| 620 | |||
| 621 | /** |
||
| 622 | * @return PropertyAccessor |
||
| 623 | * @internal |
||
| 624 | */ |
||
| 625 | public function getPropertyAccessor() |
||
| 633 | |||
| 634 | /** |
||
| 635 | * @param mixed $row item from db |
||
| 636 | * @return \Nette\Utils\Html |
||
| 637 | * @internal |
||
| 638 | */ |
||
| 639 | public function getRowPrototype($row) |
||
| 656 | |||
| 657 | /** |
||
| 658 | * Returns client-side options. |
||
| 659 | * @return array |
||
| 660 | */ |
||
| 661 | public function getClientSideOptions() |
||
| 665 | |||
| 666 | /** |
||
| 667 | * @return bool |
||
| 668 | */ |
||
| 669 | public function isStrictMode() |
||
| 673 | |||
| 674 | /** |
||
| 675 | * @return Customization |
||
| 676 | */ |
||
| 677 | public function getCustomization() |
||
| 685 | |||
| 686 | /**********************************************************************************************/ |
||
| 687 | |||
| 688 | /** |
||
| 689 | * Loads state informations. |
||
| 690 | * @param array $params |
||
| 691 | * @internal |
||
| 692 | */ |
||
| 693 | public function loadState(array $params) |
||
| 705 | |||
| 706 | /** |
||
| 707 | * Saves state informations for next request. |
||
| 708 | * @param array $params |
||
| 709 | * @param \Nette\Application\UI\PresenterComponentReflection $reflection (internal, used by Presenter) |
||
| 710 | * @internal |
||
| 711 | */ |
||
| 712 | public function saveState(array &$params, $reflection = NULL) |
||
| 717 | |||
| 718 | /** |
||
| 719 | * Ajax method. |
||
| 720 | * @internal |
||
| 721 | */ |
||
| 722 | public function handleRefresh() |
||
| 726 | |||
| 727 | /** |
||
| 728 | * @param int $page |
||
| 729 | * @internal |
||
| 730 | */ |
||
| 731 | public function handlePage($page) |
||
| 735 | |||
| 736 | /** |
||
| 737 | * @param array $sort |
||
| 738 | * @internal |
||
| 739 | */ |
||
| 740 | public function handleSort(array $sort) |
||
| 745 | |||
| 746 | /** |
||
| 747 | * @param \Nette\Forms\Controls\SubmitButton $button |
||
| 748 | * @internal |
||
| 749 | */ |
||
| 750 | public function handleFilter(\Nette\Forms\Controls\SubmitButton $button) |
||
| 770 | |||
| 771 | /** |
||
| 772 | * @param \Nette\Forms\Controls\SubmitButton $button |
||
| 773 | * @internal |
||
| 774 | */ |
||
| 775 | public function handleReset(\Nette\Forms\Controls\SubmitButton $button) |
||
| 790 | |||
| 791 | /** |
||
| 792 | * @param \Nette\Forms\Controls\SubmitButton $button |
||
| 793 | * @internal |
||
| 794 | */ |
||
| 795 | public function handlePerPage(\Nette\Forms\Controls\SubmitButton $button) |
||
| 805 | |||
| 806 | /** |
||
| 807 | * Refresh wrapper. |
||
| 808 | * @return void |
||
| 809 | * @internal |
||
| 810 | */ |
||
| 811 | public function reload() |
||
| 820 | |||
| 821 | /**********************************************************************************************/ |
||
| 822 | |||
| 823 | /** |
||
| 824 | * @return \Nette\Templating\FileTemplate |
||
| 825 | * @internal |
||
| 826 | */ |
||
| 827 | public function createTemplate() |
||
| 835 | |||
| 836 | /** |
||
| 837 | * @internal |
||
| 838 | * @throws Exception |
||
| 839 | */ |
||
| 840 | public function render() |
||
| 870 | |||
| 871 | protected function saveRememberState() |
||
| 881 | |||
| 882 | protected function applyFiltering() |
||
| 887 | |||
| 888 | /** |
||
| 889 | * @param array $filter |
||
| 890 | * @return array |
||
| 891 | * @internal |
||
| 892 | */ |
||
| 893 | public function __getConditions(array $filter) |
||
| 920 | |||
| 921 | protected function applySorting() |
||
| 960 | |||
| 961 | protected function applyPaging() |
||
| 974 | |||
| 975 | protected function createComponentForm($name) |
||
| 993 | |||
| 994 | /** |
||
| 995 | * @return array |
||
| 996 | */ |
||
| 997 | protected function getItemsForCountSelect() |
||
| 1001 | |||
| 1002 | /** |
||
| 1003 | * @internal |
||
| 1004 | * @param string $message |
||
| 1005 | */ |
||
| 1006 | public function __triggerUserNotice($message) |
||
| 1014 | } |
||
| 1015 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: