1
Actually, this way, is it very wrong? I’m not really understanding the typing:
class FinanceiroController extends Controller
{
/**
* @var ChamadosFinanceirosRepository
*/
private $chamadosFinanceirosRepository;
/**
* @var FinanceiroService
*/
private $financeiroService;
/**
* @var ChamadosFinanceirosService
*/
private $chamadosFinanceirosService;
/**
* @var ChamadosParcelasPagasService
*/
private $chamadosParcelasPagasService;
public function __construct(ChamadosFinanceirosRepository $chamadosFinanceirosRepository, FinanceiroService $financeiroService,
ChamadosFinanceirosService $chamadosFinanceirosService, ChamadosParcelasPagasService $chamadosParcelasPagasService)
{
$this->chamadosFinanceirosRepository = $chamadosFinanceirosRepository;
$this->financeiroService = $financeiroService;
$this->chamadosFinanceirosService = $chamadosFinanceirosService;
$this->chamadosParcelasPagasService = $chamadosParcelasPagasService;
}
public function getProvisionamentoPrestador()
{
return view('financeiro.provisionamentoPrestador');
}
/**
* @return mixed
* Busca os chamados financeiros com status_provisionamento_sac finalizado
*/
public function getBuscaPrestadoresFinanceirosSac()
{
return $this->chamadosFinanceirosService->buscaProvisionamentosSac(['status_provisionamento_sac','finalizado']);
}
/**
* @return mixed
* Busca os chamados financeiros pelo id financeiro
*/
public function getBuscaPrestadoresFinanceirosSacId()
{
//return $this->chamadosFinanceirosService->buscaProvisionamentosSac(['id',\Request::input('id')]);
return $this->financeiroService->buscaProvisionamentosSac(['id',\Request::input('id')]);
}
public function postGravaPagamentoPrestadorChamado()
{
return $this->chamadosParcelasPagasService->pagamentoPrestadorChamado(\Request::all());
}
}
You are not calling the class in the constructor. You are inducing the type that will be accepted by parameter
– Wallace Maxters
But I can work this way instead of instantiating ?
– Guilherme De Menezes Ferreira
No, force typing or not, will not instantiate the object. only with the new same.
– Guerra
But I can access the methods of this class !
– Guilherme De Menezes Ferreira
Are we talking about the class that owns the constructor or the parameter class? Because by forcing the typing makes your IDE start to see what’s in that variable because he’s sure what her class is going to be, so he makes the methods available to you.
– Guerra
If you are talking about the $this->class, you have to instantiate the object before passing the parameter.
– Guerra
If I fuzer like this it works $this->class->method()
– Guilherme De Menezes Ferreira