S
S
symnoob2020-05-14 12:15:49
PHP
symnoob, 2020-05-14 12:15:49

Symfony - Class, methods calling methods through pseudo-variable $this, how to do it right?

Hello everyone,

there is a controller or service, etc.
This is a simple class:

public function index(Request $request, string $anyVariable){
  anyCode...
  $secondMethod = $this->secondMethod($request, $anyVariable)

  if($secondMethod){
    dosomething...
  }
}

public function secondMethod(Request $request, string $anyVariable){
  anyCode...
  return true;
}


I need to have Request in both methods, but the second method is called only through $this of the first method.

How to be here?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question