CakePHP Aptana and Eclipse PDT code completion that works
I keep seeing people asking the question “How do I get code completion to work in Aptana and Eclipse PDT?”. A lot of the time I see the Helper fix but nothing else! With a bit of fiddling I’ve finally got a complete solution that works! Here how I did it:
Follow this guide to enable the .thtml or .ctp file extentions: Setting up Eclipse to work with Cake
Create a dummy file in your cake root directory with the following code:
<?php
exit();
//declare and define all of the helpers
//to helper enable codecompletion
if(1 == 0) {
$ajax = new AjaxHelper();
$cache = new CacheHelper();
$form = new FormHelper();
$html = new HtmlHelper();
$javascript = new JavascriptHelper();
$number = new NumberHelper();
$session = new SessionHelper();
$text = new TextHelper();
$time = new TimeHelper();
}
?>
Then to get the Model code completion from within controllers create an app_controller.php file in you app directory and add a dummy function with the following code:
<?php
class AppController extends Controller {
public function dummy () {
//for each of your models add a definition and declaration
//like the ones that follow
$this->User = new User();
$this->Post = new Post();
}
}
?>
So with a bit of luck this will help you on your way. Thanks for reading!










