-1

How to retrieve services in Nette from/inside presenters ( controllers ) to models, templates?

FantomX1
  • 1,577
  • 2
  • 15
  • 23

1 Answers1

0
  • auto-wiring (dependency injection) - How to autowire ( autowiring ) / get services in Nette from the di dependency injection container context

  • inside presenter accessing it via $this->getRouter(), $this->getAction(), etc going through such transitive relationships

  • inside Latte templates as a $presenter variable , $presenter->getRouter() etc method chaining, respectively $presenter->getContext(), it's deprecated, so rather assigning such not transitively accessible by method chaining if must, via template variables

    • inside presenter accessing it via $this->context-> ($this->context->getByName(), $this->context->getByType()) , deprecated obsolete way
FantomX1
  • 1,577
  • 2
  • 15
  • 23