开发者

CI_DB_mysql_driver CodeIgniter Class auto completion in NetBeans

开发者 https://www.devze.com 2023-04-03 01:28 出处:网络
I\'m developing project by CodeIgniter in NetBeans IDE. first of each of my file (Model and Controller) I add

I'm developing project by CodeIgniter in NetBeans IDE.

first of each of my file (Model and Controller) I add

/**
* @property CI_DB_active_record $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_Security $security
* @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 $agent
* @property CI_Validation $validation
* @property CI_Xmlrpc $xmlrpc
* @property CI_Xmlrpcs $xmlrpcs
* @property CI_Zip $zip
* @property Image_Upload $image_upload
* @property Lang_Detect $lang_detect

 * * * * * * * * Model * * * * * *

* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Config $config
* @property CI_Loader $load
* @property CI_Session $session
* @property Address_Model $address_model
* @property Admin_Mo开发者_如何学编程del $admin_model
* @property Buyer_Model $buyer_model
* @property Email_Model $email_model
* @property Product_Model $product_model
* @property Store_Model $store_model
* @property Tailor_Model $tailor_model
 */

to add auto complete to it.

but when I wanna to use query like $query = $this->db->query("YOUR QUERY");

$query don't support auto complete,when I used var_dump($query) I found this is CI_DB_mysql_driver object.

now how can I add CI_DB_mysql_driver to auto complete list by $query name?


I found a bit of a hack.

1) add:

@property CI_DB_result $query

To your model.

Then rather than $query = $this->db->query(), Use $this->query = $this->db->query().

Then, as you type $this->query, the autocompleter will come up as expected.

This will be troublesome though if you need to have 2 queries active, or a query within a loop from another query. In such cases, you would have to have 2 variables for each query.


You're using Active record library, so go to \system\database\DB_active_rec.php and then find their respective class properties and then write them to your IDE(netbeans) autocomplete library.


in system/database/DB_driver.php

change function query @return of class CI_DB_driver

@return mixed

to

@return boolean|CI_DB_result

0

精彩评论

暂无评论...
验证码 换一张
取 消