Jump to content

Method from custom page class is not accessible when used with bootstrapped API


androbey
 Share

Recommended Posts

Hi all, 

I have once again a probably unique request. 

For a project I am using a SlimPHP based approach, which is connected to a ProcessWire instance via bootstrapped API. 

In general this works very well - except when using custom page class methods. 

Method Page::getTest does not exist or is not callable in this context

Am I missing something? Or is this not supported at all? 

I tested it with both version 3.0.228 and 3.0.227.

Link to comment
Share on other sites

Hello,

Without code it's hard to help you. I found that this error is thrown by PW, Wire.php:

protected function ___callUnknown($method, $arguments) {
  if($arguments) {} // intentional to avoid unused argument notice
  $config = $this->wire()->config;
  if($config && $config->disableUnknownMethodException) return null;
  throw new WireException("Method " . $this->className() . "::$method does not exist or is not callable in this context"); 
}

So it looks like you are trying to call this method on a Page instance, and not on an instance of your custom page class.

  • Like 1
Link to comment
Share on other sites

Great, thank you very much for your tip! This has brought me on the right track: I have now requested a fresh copy from the database (via selector). Previously, a Page object was passed directly, which seemed to be just an instance of the Page class. 
Now it works!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...