PHP Stub Classes for Connect PHP 1.1 (Updated)

Update: CXDev Toolbox now includes PHP Stub Generator

The CXDev Toolbox (http://toolbox.cxdeveloper.com) now contains a tool that will generate a PHP Stub file for your specific site. The stub will include not only the core ConnectPHP objects, but also your custom fields, custom attributes and custom business objects. See it in action at http://cxdeveloper.com/article/cxdev-toolbox-php-stub-generator.

Code Complete! Tell me more.

One of the many wonderful things about IDE"s is the ability for automatic code completion. Many IDE's support this feature by utilizing PHPDoc code commenting, including Netbeans and Eclipse. This mechanism relies on the availability of source code with proper documentation, but this is not always available. In RightNow CX, the ConnectPHP API has no available source code so a developer is left without any code completion features.

Fortunately, code completion is not reliant on complete availability of source code, and instead is just fine with class/method names and accompanying PHPDoc blocks. Because of this, it is possible to use a "Class Stub", to expose what is needed to enable code completion.

Oracle Development hasn't been so kind as to offer ConnectPHP class stubs, so up until now code completion for ConnectPHP has been non-existent. This bugged me for a long time, but I finally decided to do something about it; using PHP Reflection, I was able to generate PHP Class stubs for the entire API. By downloading the class stub file and putting it in your IDE project's sources folder, you will magically get code completion for ConnectPHP!

The exact instructions for your IDE are up to you to figure out, but basically the class needs to be in your project or in your project's include path.

What about my Custom Objects?

I generated my class stubs by installing a PHP script on a RightNow site and running it. The script ALSO supports creating class stubs for Custom Objects. In the future, I will post the full script capable of generating the stubs so you can generate Custom Object stubs for your specific RightNow CX site. For now you will have to be satisfied with just the core ConnectPHP stubs.

Why only ConnectPHP v1.1?

That was all I had access to at the time. I'll post v1.2 as soon as I get access to a newer site.

Why don't some of the method stubs show parameters... such as "find", "fetch", "first"?

I don't know. Ask Oracle. I think it has something to do with those methods using argv/argc to process dynamic parameter types.... but I could be wrong

Class Stub Link

connect_1-1.php

Categories : 

Zircon - This is a contributing Drupal Theme
Design by WeebPal.