Welcome Guest, Not a member yet? Register   Sign In
InitController and phpstorm navigation
#4

(02-25-2023, 05:48 AM)You're right, it's better, but  when trying to find methods in Wrote:
PHP Code:
$this->myModel-> i can't find anything with phpstorm
Maybe i'
m missing sometingi'll try one more time with you response with a lot of coffee...
Thanks for your answer 


kenjisThis works.
But it may be better to set the type for $myModel like private MyModel $myModel;


PHP Code:
<?php

namespace App\Controllers;

use 
App\Models\MyModel;
use 
CodeIgniter\HTTP\RequestInterface;
use 
CodeIgniter\HTTP\ResponseInterface;
use 
Psr\Log\LoggerInterface;

class 
Home extends BaseController
{
    private $myModel;

    public function initController(
        RequestInterface $request,
        ResponseInterface $response,
        LoggerInterface $logger
    
) {
        parent::initController($request$response$logger);

        $this->myModel model(MyModel::class);
    }

    public function index()
    {
        $this->myModel->
    }

Reply


Messages In This Thread
RE: InitController and phpstorm navigation - by Kris40 - 02-27-2023, 08:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB