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

Uncaught TypeError when listing NoteAttachmentMasterCardAction #164

Open
basst85 opened this issue Oct 24, 2018 · 7 comments
Open

Uncaught TypeError when listing NoteAttachmentMasterCardAction #164

basst85 opened this issue Oct 24, 2018 · 7 comments

Comments

@basst85
Copy link

basst85 commented Oct 24, 2018

Steps to reproduce:

I'm using this code:

$mastercardActions = MasterCardAction::listing($monetaryAccountId)->getValue();
$mastercardActionId = $mastercardActions[0]->getId();
$mastercardActionAttachments = NoteAttachmentMasterCardAction::listing($mastercardActionId,$monetaryAccountId)->getValue();

But it's returning this error:

Fatal error: Uncaught TypeError: Argument 1 passed to bunq\Model\Core\BunqModel::createFromResponseArray() must be of the type array, integer given, called in /var/www/domain.com/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php on line 242 
and defined in /var/www/domain.com/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:103 Stack trace: #0 /var/www/domain.com/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php(242): bunq\Model\Core\BunqModel::createFromResponseArray(3647492, NULL) #1 /var/www/domain.com/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php(207): bunq\Model\Core\BunqModel::createListFromResponseArray(Array) #2 /var/www/domain.com/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php(165): bunq\Model\Core\BunqModel::determineFieldContents(Object(ReflectionProperty), Array) #3 /var/www/domain.com/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php(119): bunq\Model\Core\BunqModel::createInstanceFromResponseArray(Array) #4 /var/www/domain.com/ in /var/www/domain.com/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php on line 103

What should happen:

  1. Return a JSON object with attachments

What happens:

  1. Retuns an error

Traceback

SDK version and environment

  • Tested on 1.1.0
  • Sandbox
  • Production

Response id

None

@OGKevin
Copy link
Contributor

OGKevin commented Oct 24, 2018

hmm, @kojoru sounds like a view definition error. Same as #76

@OGKevin
Copy link
Contributor

OGKevin commented Oct 24, 2018

@basst85 if you enable debugger you should be able to see/find out what its trying to deserialise and fix it by doing something like #76 (comment)

@basst85
Copy link
Author

basst85 commented Oct 24, 2018

@OGKevin @kojoru There is something "strange" with the returnvalue of $responseArray in the function fromJsonList() (in BunqModel):
https://pastebin.com/ciGZ7k6L

The attachment object in the end of the file is strange.. ?

The response JSON:
https://pastebin.com/RbfsYRNW

@OGKevin
Copy link
Contributor

OGKevin commented Oct 24, 2018

found it :)

          "attachment": {
                "id": 3647492,
                "description": "",
                "content_type": "image\/jpeg"
            }

is an object but, this is how it's defined:

/**
* The attachment attached to the note.
*
* @var AttachmentMonetaryAccountPayment[]
*/
protected $attachment;

So please remove the [] from the doc and it should be good.

@OGKevin
Copy link
Contributor

OGKevin commented Oct 24, 2018

so @kojoru this can either be an view definition mistake or the actual response is wrong :)

@basst85
Copy link
Author

basst85 commented Oct 24, 2018

found it :)

          "attachment": {
                "id": 3647492,
                "description": "",
                "content_type": "image\/jpeg"
            }

is an object but, this is how it's defined:

sdk_php/src/Model/Generated/Endpoint/NoteAttachmentMasterCardAction.php

Lines 72 to 77 in f369d3b

 /** 
  * The attachment attached to the note. 
  * 
  * @var AttachmentMonetaryAccountPayment[] 
  */ 
 protected $attachment; 

So please remove the [] from the doc and it should be good.

Yes! That works indeed. Thanks!

@basst85
Copy link
Author

basst85 commented Nov 21, 2018

@kojoru Any update on this small bug?

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

2 participants