Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Doesn't support object context #34

Description

@betweenbrain

While hacking on an existing module, I thought it would be able nice to add an Ajax method to proxy an existing one, For example:

    public function getAjax()
{
            // Proxy an existing method, maybe used elsewhere, for Ajax.
    return $this->getFoo();
}

public function getFoo()
{
            // A whole bunch of code normally goes here for stuff written some time ago
    return 'foo;
}

But, this doesn't work as we'll get a Fatal error: Using $this when not in object context due to https://github.com/Joomla-Ajax-Interface/component/blob/master/site/ajax.php#L90.

We could check to see if that method is static, then call it like the following if not:

$helperClass = new $class; $results = call_user_func($helperClass . '->' . $method . 'Ajax');

But, this may have an issue if we don't pass any required parameters when instantiating the class.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions