BasePresenter and $this->template triggers Creation of dynamic property is deprecated
- Ajax
- Member | 59
Hello All!
Back to Nette after 5 years, I installed Nette 3.2 and PHP 8.3 and tried to fill layout variable (for nav) like few years ago. And, as suggested, I used template class for variables. But that caused the problem. Here is my code:
home/default.latte
:
@layout.latte
is standard, just on beginning, I added
This code triggers strange error:
Creation of dynamic property App\Presenters\HomeTemplate::$availableProjects is deprecated
.
Strange is, that he is looking for $availableProjects
variable in
HomeTemplate, but I'm using it it in BasePresenter and layout. When I comment
out line
$this->template->availableProjects = ['a', 'b', 'c'];
, error
is gone. Is there any way to fix it? Is there better way to share code for
layout in all presenters without adding variable in all template classes?
Thanks in advance!