natanfelles / codeigniter-phpstorm

PhpStorm Code Completion for CodeIgniter 3

Home Page:https://natanfelles.github.io/blog/codeigniter-code-completion-phpstorm.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can i add some model in it?

weituotian opened this issue · comments

# can my model can be showed by adding my model property in the file?

Yes. Just add something like:

/**
 * Class Profile
 * @property   General_model $general
 * @property   Profile_model $profile
 */
class Profile extends CI_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->model('general_model', 'general');
        $this->load->model('profile_model', 'profile');
    }

    public function index()
    {
        // Settings from General_model
        $data['settings'] = $this->general->get_settings();
        ...
    }

This file too works in Netbeans if do you want. :)

thanks!it work very well!!!

Brilliant, thank you!

Awesome!

@natanfelles I think you should include this in README.md.

And if you extend a Model (like User_Model) from another model, like MY_Model, you just write something like:

/**
 * Class User
 * @property   User_model $user_model
 * @property   MY_Model $MY_model
 */

Now PHP Storm can assist you with your functions from MY_Model when you write code in the User controller.