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 object, FALSE otherwise. Enjoy, John On Dec 9, 10:24 am, Jeremy Burns <[email protected]> wrote: > 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_exists($this->{$this->modelClass}->relations())): > return $this->{$this->modelClass}->relations($id); > else: > return array(); > endif; > > } > > Any ideas? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
