Re: Function exists

2009-12-09 Thread Jeremy Burns
Perfect - thank you John. My code is now: function relations($id = null) { if (method_exists ($this->modelClass,'relations')): return $this->{$this->modelClass}->relations($id); else: return array(); endif; } On Dec 9, 11:26 am, John Anderse

Re: Function exists

2009-12-09 Thread John Andersen
Hi Jeremy Try to use the class/object method "method_exists" instead! Definition: method_exists -- Checks if the class method exists Description bool method_exists ( object object, string method_name) This function returns TRUE if the method given by method_name has been defined for the given ob

Function exists

2009-12-09 Thread Jeremy Burns
I want to call a function in a controller from my app_controller, but want to check it exists first. I've fiddled around with function_exists but can't get the syntax right. This is the current version of the code (which doesn't work): function getRelations($id = null) { if (function_exis