• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Phpstorm $this->model_name->method() highlighted

#1
Hello, i am new with CodeIgniter so i started to read the docs, specially in the "Model" section there is a code:


$this->load->model('model_name');
$this->model_name->method();



I downloaded Phpstorm Codeigniter plugin and Codeigniter Snippets plugin.But there is still a problem with the code above, when i type:

$this->model_name   - it gets highlighted so it is not found and i cant get autocomplete for the methods in the model class. Should i put some Phpdoc annotation ?
Reply

#2
at the start of your controller class put phpdoc like this
PHP Code:
/**
* Class Google
* @property Stock_model $stock_model
* @property Shop_model $shop_model
*/


class Google extends Admin_Controller{
 function __construct()
   {
       parent::__construct();
       $this->load->model('back/stock_model'); 
Reply

#3
Hi,

Solution Here
A good decision is based on knowledge and not on numbers. - Plato

Reply

#4
Thanks to both of you, but now the other problem are the variables passed to the view:
Controller:
     
PHP Code:
 $data['curr_url'] = current_url();
 $this->load->view('test_view'$data); 

View:
       
PHP Code:
/**
* @see Main::index()
* @var Main $curr_url
*/

echo $curr_url 

It highlights the $curr_url and it says that there is no "__toString" method in Main controller class.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.