<?php die('This file is not really here!'); | |
/** | |
* ------------- DO NOT UPLOAD THIS FILE TO LIVE SERVER --------------------- | |
* | |
* Implements code completion for CodeIgniter in phpStorm | |
* phpStorm indexes all class constructs, so if this file is in the project it will be loaded. | |
* ------------------------------------------------------------------- | |
* Drop the following file into a CI project in phpStorm | |
* You can put it in the project root and phpStorm will load it. | |
* (If phpStorm doesn't load it, try closing the project and re-opening it) | |
* | |
* Under system/core/ | |
* Right click on Controller.php and set Mark as Plain Text | |
* Do the same for Model.php | |
* ------------------------------------------------------------------- | |
* This way there is no editing of CI core files for this simple layer of code completion. | |
* | |
* PHP version 5 | |
* | |
* LICENSE: GPL http://www.gnu.org/copyleft/gpl.html | |
* | |
* Created 1/28/12, 11:06 PM | |
* | |
* @category | |
* @package CodeIgniter CI_phpStorm.php | |
* @author Jeff Behnke | |
* @copyright 2009-11 Valid-Webs.com | |
* @license GPL http://www.gnu.org/copyleft/gpl.html | |
* @version 2012.01.28 | |
*/ | |
/** | |
* @property CI_DB_active_record $db This is the platform-independent base Active Record implementation class. | |
* @property CI_DB_forge $dbforge Database Utility Class | |
* @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them.<br /> Memory consumption can also be displayed. | |
* @property CI_Calendar $calendar This class enables the creation of calendars | |
* @property CI_Cart $cart Shopping Cart Class | |
* @property CI_Config $config This class contains functions that enable config files to be managed | |
* @property CI_Controller $controller This class object is the super class that every library in.<br />CodeIgniter will be assigned to. | |
* @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP. | |
* @property CI_Encrypt $encrypt Provides two-way keyed encoding using XOR Hashing and Mcrypt | |
* @property CI_Exceptions $exceptions Exceptions Class | |
* @property CI_Form_validation $form_validation Form Validation Class | |
* @property CI_Ftp $ftp FTP Class | |
* @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking. | |
* @property CI_Image_lib $image_lib Image Manipulation class | |
* @property CI_Input $input Pre-processes global input data for security | |
* @property CI_Lang $lang Language Class | |
* @property CI_Loader $load Loads views and files | |
* @property CI_Log $log Logging Class | |
* @property CI_Model $model CodeIgniter Model Class | |
* @property CI_Output $output Responsible for sending final output to browser | |
* @property CI_Pagination $pagination Pagination Class | |
* @property CI_Parser $parser Parses pseudo-variables contained in the specified template view,<br />replacing them with the data in the second param | |
* @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data<br />in order to help with debugging and optimization. | |
* @property CI_Router $router Parses URIs and determines routing | |
* @property CI_Session $session Session Class | |
* @property CI_Sha1 $sha1 Provides 160 bit hashing using The Secure Hash Algorithm | |
* @property CI_Table $table HTML table generation<br />Lets you create tables manually or from database result objects, or arrays. | |
* @property CI_Trackback $trackback Trackback Sending/Receiving Class | |
* @property CI_Typography $typography Typography Class | |
* @property CI_Unit_test $unit_test Simple testing class | |
* @property CI_Upload $upload File Uploading Class | |
* @property CI_URI $uri Parses URIs and determines routing | |
* @property CI_User_agent $user_agent Identifies the platform, browser, robot, or mobile devise of the browsing agent | |
* @property CI_Validation $validation //dead | |
* @property CI_Xmlrpc $xmlrpc XML-RPC request handler class | |
* @property CI_Xmlrpcs $xmlrpcs XML-RPC server class | |
* @property CI_Zip $zip Zip Compression Class | |
* @property CI_Javascript $javascript Javascript Class | |
* @property CI_Jquery $jquery Jquery Class | |
* @property CI_Utf8 $utf8 Provides support for UTF-8 environments | |
* @property CI_Security $security Security Class, xss, csrf, etc... | |
*/ | |
class CI_Controller{} | |
/** | |
* @property CI_DB_active_record $db This is the platform-independent base Active Record implementation class. | |
* @property CI_DB_forge $dbforge Database Utility Class | |
* @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them.<br /> Memory consumption can also be displayed. | |
* @property CI_Calendar $calendar This class enables the creation of calendars | |
* @property CI_Cart $cart Shopping Cart Class | |
* @property CI_Config $config This class contains functions that enable config files to be managed | |
* @property CI_Controller $controller This class object is the super class that every library in.<br />CodeIgniter will be assigned to. | |
* @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP. | |
* @property CI_Encrypt $encrypt Provides two-way keyed encoding using XOR Hashing and Mcrypt | |
* @property CI_Exceptions $exceptions Exceptions Class | |
* @property CI_Form_validation $form_validation Form Validation Class | |
* @property CI_Ftp $ftp FTP Class | |
* @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking. | |
* @property CI_Image_lib $image_lib Image Manipulation class | |
* @property CI_Input $input Pre-processes global input data for security | |
* @property CI_Lang $lang Language Class | |
* @property CI_Loader $load Loads views and files | |
* @property CI_Log $log Logging Class | |
* @property CI_Model $model CodeIgniter Model Class | |
* @property CI_Output $output Responsible for sending final output to browser | |
* @property CI_Pagination $pagination Pagination Class | |
* @property CI_Parser $parser Parses pseudo-variables contained in the specified template view,<br />replacing them with the data in the second param | |
* @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data<br />in order to help with debugging and optimization. | |
* @property CI_Router $router Parses URIs and determines routing | |
* @property CI_Session $session Session Class | |
* @property CI_Sha1 $sha1 Provides 160 bit hashing using The Secure Hash Algorithm | |
* @property CI_Table $table HTML table generation<br />Lets you create tables manually or from database result objects, or arrays. | |
* @property CI_Trackback $trackback Trackback Sending/Receiving Class | |
* @property CI_Typography $typography Typography Class | |
* @property CI_Unit_test $unit_test Simple testing class | |
* @property CI_Upload $upload File Uploading Class | |
* @property CI_URI $uri Parses URIs and determines routing | |
* @property CI_User_agent $user_agent Identifies the platform, browser, robot, or mobile devise of the browsing agent | |
* @property CI_Validation $validation //dead | |
* @property CI_Xmlrpc $xmlrpc XML-RPC request handler class | |
* @property CI_Xmlrpcs $xmlrpcs XML-RPC server class | |
* @property CI_Zip $zip Zip Compression Class | |
* @property CI_Javascript $javascript Javascript Class | |
* @property CI_Jquery $jquery Jquery Class | |
* @property CI_Utf8 $utf8 Provides support for UTF-8 environments | |
* @property CI_Security $security Security Class, xss, csrf, etc... | |
*/ | |
class CI_Model{} |
This comment has been minimized.
This comment has been minimized.
Agreed. But the issue with that is getting methods to work, which is what others complained about. Ie. $this->load->view() view with have a warning "Undefined method" Using the above solved it for me, and hopefully others. Thanks for your input and I do agree that it would be a better route. it just doesn't seem to work as well. |
This comment has been minimized.
This comment has been minimized.
Update: If you go back and mark CI_Controller and CI_Model as plain text you get the same result as my original code. Something else to consider, if a persons app controllers extend CI_Controller the Gist is simpler as they don't have to edit all of their controllers. |
This comment has been minimized.
This comment has been minimized.
I've had decent success with this - thanks VERY MUCH Jeff @topdown. My question is: is there a way of getting functions in helper files to be known by the auto complete. Perhaps I'm missing something obvious. For example, I am autoloading url and misc and specifically load others but the functions therein a unrecognized. |
This comment has been minimized.
This comment has been minimized.
A more elegant solution is to modify the approach posted here: https://github.com/Stunt/Codeigniter-autocomplete/ Just add one autocomplete.php file to the application/config/ folder and done. I used your doc block because it is more comprehensive and well-defined. Then I just added my model and library @Property tags below the your CI property tags in the same doc block preceding the CI_Controller class. Other advantages:
|
This comment has been minimized.
This comment has been minimized.
Please how can i make the autocomplete to work as well in the view's file? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thank you man |
This comment has been minimized.
You can also put the stuff above CI_Controller into a MY_Controller.php file that extends CI_Controller and the stuff above CI_Model into a MY_Model.php file that extends CI_Model and all of your custom controllers now need to extend MY_Controller and all of your custom models not need to extend MY_Model. Now you don't have to have a file sitting in the root of your project that is only for code completion in development and you don't have to try to remember to mark CI_Model.php and CI_Controller.php in system/core as Mark as Plain Text for other projects.