Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument 1 passed to PrintNode\Request::__construct() must be an instance of PrintNode\Credentials #14

Open
maykino opened this issue Dec 4, 2016 · 5 comments

Comments

@maykino
Copy link

maykino commented Dec 4, 2016

One of the examples show the following however it doesn't work:

$credentials = new PrintNode\ApiKey(
PRINTNODE_APIKEY
);
$request = new PrintNode\Request($credentials);

Error:

Catchable Fatal Error: Argument 1 passed to PrintNode\Request::__construct() must be an instance of PrintNode\Credentials, instance of PrintNode\ApiKey given

@foxcave
Copy link

foxcave commented Dec 27, 2016

For the examples replace those lines with;

$credentials = new PrintNode\Credentials();
$credentials->setApiKey(PRINTNODE_APIKEY);

@casperbakker
Copy link

This is indeed a problem. Why have an ApiKey object if it cannot be used? I think the Request object is wrong.

@ebofi
Copy link

ebofi commented Apr 17, 2020

$credentials->setApiKey(PRINTNODE_APIKEY);

After adding this , we see [17-Apr-2020 11:10:27 UTC] PHP Fatal error: Call to a member function setApiKey() on a non-object in /home/u/public_html/print/example-1-submitting-a-printjob.php on line 13

@Jim266
Copy link

Jim266 commented Jun 26, 2020

I replaced
$credentials = new PrintNode\ApiKey(
"xxxx"
);

with
$credentials = new PrintNode\Credentials();
$credentials->setApiKey("xxxx");

and now get the following error
Fatal error: Uncaught BadMethodCallException: Method PrintNode\Request::agetComputers does not exist in C:\xampp\htdocs\test\vendor\printnode\printnode-php\src\PrintNode\Request.php:144

Can anyone help?

@Jim266
Copy link

Jim266 commented Jun 26, 2020

Sorry for false alarm. Just noticed that I accidentally altered the function name to agetComputers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants