Yii plugin adds useful enhancements to NetBeans IDE including the following:
- Code completion in views (including variables passed to view and
$this). - Go To Action, Go To View.
- Go to view via clicking on
renderorrenderPartialargument. - Go to file via clicking on path alias (
Yii::import,widget,beginWidget,createWidget,beginCache). - New project wizard.
BAJAR PLUGIN
AGREGAR EL TEMPLATE AL EDITOR DEL NETBEANS O AGREGARLOS MANUALMENTE AL EDITOR:
http://www.cheatography.com/hoplayann/cheat-sheets/yii-code-templates-for-netbeans/
o BAJAR Y INSTALAR EN EL DIRECTORIO DEL NETBEANS:
TEMPLATE
AGREGAR EL TEMPLATE AL EDITOR DEL NETBEANS O AGREGARLOS MANUALMENTE AL EDITOR:
http://www.cheatography.com/hoplayann/cheat-sheets/yii-code-templates-for-netbeans/
You can create code templates for commonly used/overridden function in Yii. For example, if you want to add an beforeSave() function in your model, by typing a shortcut you can automatically have the function template in place. There are additional shortcuts for common stuff like Yii::app(), Yii::t(), Yii::app()->user->checkAccess(), and more!
- Download this template set to get started: http://fbe.am/hly (version 2). View all available commands in this printable cheat sheet.
- Go to "Tools > Options > Editor > Code Templates"
- Hit "Import", select the file, and choose "Code Templates"
- You might get an error message "invalid zip file" if you are importing to a older/newer version of NetBeans. Open up the zip file, edit build.info, and set the correct path to Userdir.
Usage:
- Type the shortcut and hit TAB
- More info: NetBeans Doc
o BAJAR Y INSTALAR EN EL DIRECTORIO DEL NETBEANS:
TEMPLATE
Navigation


Run Command

Code Completion

Usage
Install Plugin
Download a nbm file or create it by yourself. And please, install it.
How to enable
- Use default directory structure (don't delete yiic* files)
- project properties > Framework > Yii, check
enabled(You don't have to check this if you use plugin with default app)
Existing Source
Source directory : Please, specify the webroot directory
Webroot directory : Please, keep default (Source directory)
Webroot directory : Please, keep default (Source directory)
e.g.
testdrive (webroot directory)
├── assets
├── css
├── images
├── index-test.php
├── index.php
├── nbproject
├── protected
└── themes
Existing Source (Source Directory has other directories)
Please set webroot directory(yii path alias named "webroot" i.e. webroot is testdrive on the below tree) to webroot of project properties.
Right-click project > properties > Source > Webroot
e.g.
my_source (source directory)
├── testdrive (webroot directory)
│ ├── assets
│ ├── css
│ ├── images
│ ├── index-test.php
│ ├── index.php
│ ├── protected
│ └── themes
│
├── ...
├── foo
└── bar
Path settings
You can set the some paths(e.g. path alias) to project properties. If you use defferent path from default, please set relative path there from source directory.
I have added path settings to project properties.
Usage
Please set relative path from source directory.
e.g.
Please set
e.g.
Please set
protected/myext to ext: if extensions directory is the following:myproject
├─protected
│ └─myext (extensions directory)
├─...
If you want to use default directory, please set empty.
e.g.
e.g.
application: myprotectedcontrollers: (empty)views: (empty)
controllers directory means myprotected/controllers. views directory means myprotected/views.
Features
- Badge icon
- Go To Action
- Go To View
- Code Completion on the view file
- Code Completion for the path
- Init Action
- PHPUnit Test Init Action
- New Yii Project Wizard
- Run Action Action
- Navigation for path alias (Hyperlink to file)
- Run Command Action
Go To Action
You can open the controller file and move action method.
e.g. WebRoot/protected/views/site/index.php -> WebRoot/protected/controllers/SiteController.php::actionIndex()
- open a view file
- Right-click on Editor
- Navigate > Go To Action
Go to View
You can open the view file for action method of the controller.(similar to Go To Action)
- open a controller file
- move the caret to action method
- Right-click on Editor
- Navigate > Go To View
If you set the keymap for this action, it's more useful.(Please, search with "php")
If you set the theme on main.php, you will go to there.
If you set the theme on main.php, you will go to there.
Hyper link to view file
You can open the view file from parameter of render and renderPartial methods. This is available on the Controller or View files.
e.g.
When you use the render method like above, if foo.php exists, you do the following.
fallback to default views
You can fallback to default views if view file for your theme doesn't exist when you use the theme. If you would like to this feature, please, check "Fallback to ..." on project properties for Yii.
- Hold down Ctrl key on the first parameter (foo)
- Wait to be changed string color to blue
- Click (foo)
It will go to theme file if you use theme.
Navigation for path alias (Hyperlink to file)
Usage is the same as hyperlink to view file.
This feature is available for the followings:
- Yii::import()
- Yii::t()
- CBaseController::widget()
- CBaseController::beginWidget()
- CBaseController::endWidget()
- CBaseController::createWidget()
- CBaseController::beginCache()
- CBaseController::beginContent()
- Hold down
Ctrlon target path - string color is changed to blue if file exists(file path is displeyed as tooltip)
- Click > open file
e.g.
Furthermore... Class name is also valid at the other places.
e.g.
e.g.
i18n
Notice
- This feature works with default path alias name.
- Automatically file creation is valid with only render and renderPartial methods.
Code Completion on the view file
Provide support for code completion on the View file.
e.g. webapp/protected/controllers/SiteController.php
e.g. webapp/protected/views/site/index.php
Code Completion for the path
This is available the following methods:
- render
- renderPartial
- beginContent
- beginCache
- import
- *widget
e.g.
Init Action
Run the followings:
- Set framework directory path to Project Properties.
- Create a file for code completion.
Project right-click > Yii > Init
Testing
To run functional tests and unit tests in Yii, recommended is installing PHPUnit and SeleniumRC.
- Install PHPUnit
- Follow the official version 3.6 installation instructions.
- Open "Tools > Options > PHP > Unit Testing" and set the correct path to the launch script. This is phpunit.bat in Windows and usually /usr/bin/phpunit in Linux.
- Install SeleniumRC by getting the NetBeans plugin
- Open "Tools > Plugins > Available Plugins"
- Install "Selenium Module for PHP"
- Configure project options
- Open "File > Project properties > Sources" and set "Test Folder" to [PROJECT ROOT]/protected/tests (If the whole project testing doesn't work, try [PROJECT ROOT]/protected/tests/unit)
- Open "File > Project properties > PHPUnit" and set "Use Bootstrap" to [PROJECT ROOT]/protected/tests/bootstrap.php, and "Use XML Configuration" to [PROJECT ROOT]/protected/tests/phpunit.xml
Usage:
- Test whole project: Alt+F6
- Test single file: Shift-F6
- Check code coverage (right click project > Code Coverage)
4. Debugging
- Install Xdebug (usually already available in your installation):
- Include the Xdebug extension for PHP:
- In php.ini enable (by removing ; prefix) these settings:
zend_extension = "C:\xampp\php\ext\php_xdebug.dll" xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp" xdebug.remote_host = "localhost" xdebug.remote_port = 9000
- In php.ini enable (by removing ; prefix) these settings:
Usage:
- Debug project: Ctrl-F5
- Use breakpoints, walk through running code, and watch variables and objects in real-time. :)
- If you want to stop the debugger from pausing on the first line for every request, simply turn that "feature" off by clicking: Tools > Options > PHP > Debugging > Stop at First Line (uncheck)
PHPUnit Test Init Action
Set bootstrap.php and phpunit.xml to project properties.
Project right-click > Yii > PHPUnit Test Init
New Yii Project Wizard
Set yiic.php
Tools > Option > PHP > Yii Please set the path to YiiRoot/framework/yiic.php (Browse... please choose the yiic.php file)
Create new project
- File > New Project
- Categories : PHP, Projects : PHP Application
- Set Name and Location
- Set Run Configuration
- PHP Frameworks > Yii PHP Web Framework
Run the followings:
- If you check PHPUnit settings, Run PHPUnit Test Init Action.
- Create a file for code completion.
- Set include path.
Run Action Action
Run action for current caret position. i.e. Open the browser. If the action has some arguments, you have to set some arguments.(#9)
Run Command Action
Support for yiic command.
- Right-click project > Yii > Run Command... or
Alt + Shift + X
yiic.php
This action uses
protected/yiic.php. If it doesn't exist, Tools > Options > PHP > Yii > yii script is used. If it doesn't also exist, you can't run Run Command.
No hay comentarios.:
Publicar un comentario