Welcome Guest, Not a member yet? Register   Sign In
deprecated Creation of dynamic property
#1

Hello,
I'm using php 8.2 and ci 4.3.2 and i got
Creation of dynamic property App\Controllers\Document::$compteModel is deprecated

APPPATH/Controllers/Document.php at line 17


PHP Code:
11    public function initController(
12        \CodeIgniter\HTTP\RequestInterface $request,
13        \CodeIgniter\HTTP\ResponseInterface $response,
14        \Psr\Log\LoggerInterface $logger
15    
) {
16        parent::initController($request$response$logger);        
17        $this
->compteModel = new compteModel();
18        $this->ecritureModel = new ecritureModel();
19    


As you can see it above, in all my controllers, i put access to models in the init part to avoid writing many times
PHP Code:
[...] new someModel() 

in the different methods

I fought that, adding
Code:
protected $compteModel;

solved the issue

Is that a good way ?

Thanks, nice day !
Eric
Reply


Messages In This Thread
deprecated Creation of dynamic property - by foxbille - 03-21-2023, 03:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB