Zareef,I have a function to load the classes and return the object.
function LoadClass($ClassName) { require_once("Class.$ClassName.inc"); return new $ClassName(); }
Its working fine.
But Zend Studio's Code completion is not working for this type of object, Any hints?
In Zend Studio 4.0 (not sure about earlier versions) you can use a "class type hint" to let the editor know what type of object you are working with. This is especially useful when you are using factory methods to create objects (as I often do with PEAR DataObjects) or have a setup similar to the above. The documentation for this in the studio distribution appears to be broken because it says something like "See below for example" but there is actually no example (I filed a bug with Zend about this). Butm, if you dig through he "Quick Tips" you can find the example which is where I first came across it.
Here's how I use it for DataObjects: -------------- $user_obj =& DB_DataObject::factory('User'); /* @var $user_obj DataObjects_User */ $user_obj->youShouldHaveCodeCompletionNowForThisObject(); --------------
In your example it would be something like: -------------- $user_obj = LoadClass('user'); /* @var $user_obj user */ $user_obj->youShouldHaveCodeCompletionNowForThisObject(); --------------
You'll need to make sure that Zend Studio knows to look through the file that contains the class that you are dynamically loading. I think you can do this if your code is withint a "project" and you specify it with "Add to Project".
- Jamie
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php