Difference between #17 and #20 of
NetBeans IDE and Yii projects

Revision #20 has been created by Darwin Wen on Oct 21, 2011, 8:21:38 AM with the memo:

Add chinese version url
« previous (#17) next (#29) »


Title unchanged

NetBeans IDE and Yii projects

Category unchanged


Yii version unchanged

Tags unchanged

IDE, Selenium, PHPUnit, XDebug, NetBeans

Content changed

## Code completion

To get context sensitive code completion, follow these steps:

- Include Yii folder (
assuming it is properly placed outside project directory)
- Open "File > Project properties > PHP Include Path" and add the Yii framework root path
- Ignore yiilite.php to avoid doubled/missing documentation
- Add to the front of "Files Ignored by the IDE" the file "^(_yiilite\\.php_|CVS|SCCS|...."
- Restart NetBeans
In your code, you'll most likely want to have code completion for class methods/properties for objects passed in the global namespace to "current" file your editing. For example, whCode completion in view files.
  - Add the following PHPDoc statem
ent a controller object is being passed into a view file. To have code completion in this case, you have to tell the IDE what's the class of this object. This is achieved by adding a simple comment line (a 1 line php doc block) declaring the class of the object. This comment should be placed in a line before using this object, with no new empty lines in between. For example, in the code section below, which is part of some view file, adding the comment makes the IDE think that $this is of type YourController, and adds code completion accordingly:
/* @var $this YourController */
$this->getSomeProValue(); // whatever method/prop.
For above and many more reasons, Yii core files should be kept **outside** project directory and anywhere outside any web-accessible directory. I.e. if you keep your project files in Apache's _httpd_ directory, it is wise to create a new dir (called _yii_, _framework_ or smth. like that) in the same level of dirtree (inside Apache main folder, **not** in _httpd_ dir!) and put Yii core files there. If you do that, you have to include Yii folder in _Include Path_, as it is written above.
t the head of the file to use code completion in view files. (you may add additional passed parameters as well)
/* @var $this PostController */
/* @var $model Post */
$this->getSomeProValue(); // possible with code completion
$model->author; // possible with code completion

#### Usage:
## Debugging

- In
stall Xdebug (usually already avaiclude the Xdebug extension for PHP (should already be available): - In php.ini enable (by remove trailing comment semicolon sign - ;ing ; prefix) these settings: <pre>zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
## Got problems or questions?
Do NOT post a comment on this wiki page, but go to the forums:

- [Chinese version](http://www.itkuaixun.com/bbs/thread-216-1-1.html "Chinese version")
65 0
Viewed: 203 120 times
Version: 1.1
Category: Tutorials
Written by: marcovtwout
Last updated by: marcovtwout
Created on: Sep 21, 2010
Last updated: 3 years ago
Update Article


View all history