Reputation: 1420
While there are many answers on how to get PhpStorm to recognize the CodeIgniter 2.x core functions, I can not figure out how to get it to recognize the CodeIgniter 3.0 database functions.
I have an autocomplete.php
file in my config directory that works great for CodeIgniter 2.x (and most of v3.0). Since v3 removed the active record class, the DB functions are no longer recognized.
// help IDE(s) support Codeigniter 2.0
* @property CI_DB_active_record $db <-- no longer valid.
...
*/
How can I get PhpStorm autocomplete working with the new CI v3 DB class?
Update: Here is my autocomplete.php file:
<?php
// help IDE(s) support Codeigniter 2.0
/**
* @property CI_DB_query_builder $db
* @property CI_DB_forge $dbforge
* @property CI_Benchmark $benchmark
* @property CI_Calendar $calendar
* @property CI_Cart $cart
* @property CI_Config $config
* @property CI_Controller $controller
* @property CI_Email $email
* @property CI_Encrypt $encrypt
* @property CI_Exceptions $exceptions
* @property CI_Form_validation $form_validation
* @property CI_Ftp $ftp
* @property CI_Hooks $hooks
* @property CI_Image_lib $image_lib
* @property CI_Input $input
* @property CI_Language $language
* @property CI_Loader $load
* @property CI_Log $log
* @property CI_Model $model
* @property CI_Output $output
* @property CI_Pagination $pagination
* @property CI_Parser $parser
* @property CI_Profiler $profiler
* @property CI_Router $router
* @property CI_Session $session
* @property CI_Sha1 $sha1
* @property CI_Table $table
* @property CI_Trackback $trackback
* @property CI_Typography $typography
* @property CI_Unit_test $unit_test
* @property CI_Upload $upload
* @property CI_URI $uri
* @property CI_User_agent $user_agent
* @property CI_Validation $validation
* @property CI_Xmlrpc $xmlrpc
* @property CI_Xmlrpcs $xmlrpcs
* @property CI_Zip $zip
*
*
*
* These are samples entries to make my own functions work. Remove these and add you custom ones.
* @property Tank_auth $tank_auth
* @property Users_model $users_model
* @property Firms_model $firms_model
* @property Event_types_model $event_types_model
* @property Files_model $files_model
* @property Milestones_model $milestones_model
*
*
*/
class CI_Controller {}; class MY_Controller extends CI_Controller {}; class Welcome extends MY_Controller {}; class Admin_Controller extends MY_Controller {}; class CI_Model {}; class MY_Model extends CI_Model {};/**
* @property CI_DB_query_builder $db
* @property CI_DB_forge $dbforge
* @property CI_Config $config
* @property CI_Loader $load
* @property CI_Session $session
*/
// class CI_Model {};
/* End of file autocomplete.php */
/* Location: ./application/config/autocomplete.php */
In a controller, $this->db->where(); is recognized and a command click takes me to the source of that function. However, $query->num_rows() gives a "Cannot find a declaration to go to" error when clicked.
In a Model, none of the CI DB functions are recognized.
Upvotes: 2
Views: 2609
Reputation: 272
It is very simple to do with the following steps:-
Upvotes: 0
Reputation: 139
index.php
is).system/core/
Controller.php
and choose Mark as Plain Text
Model.php
I am using PhpStorm 9 may this help.
Upvotes: 2