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: Argument 1 passed to Piggy\Api\Models\CustomAttributes\Group::__construct() #30

Closed
multiplehats opened this issue Jul 4, 2024 · 1 comment
Assignees

Comments

@multiplehats
Copy link

multiplehats commented Jul 4, 2024

I'm working on the Piggy WordPress plugin, and I receive an error when calling this static method:

/**
 * Update a contact.
 *
 * @throws RouteException On error.
 * @param \WP_REST_Request $request Request object.
 * @return \WP_REST_Response
 */
protected function get_route_update_response(WP_REST_Request $request) {
         // This throws
	$attributes_list = CustomAttribute::list(["entity" => "contact"]);
}

The logs are as follows:

[04-Jul-2024 13:33:15 UTC] PHP Notice:  Undefined property: stdClass::$id in /Users/jayden/Code/piggy/apps/plugin/vendor/piggy/piggy-php-sdk/src/StaticMappers/CustomAttributes/GroupMapper.php on line 13
[04-Jul-2024 13:33:15 UTC] PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Piggy\Api\Models\CustomAttributes\Group::__construct() must be of the type int, null given, called in /Users/jayden/Code/piggy/apps/plugin/vendor/piggy/piggy-php-sdk/src/StaticMappers/CustomAttributes/GroupMapper.php on line 16 and defined in /Users/jayden/Code/piggy/apps/plugin/vendor/piggy/piggy-php-sdk/src/Models/CustomAttributes/Group.php:27
Stack trace:
#0 /Users/jayden/Code/piggy/apps/plugin/vendor/piggy/piggy-php-sdk/src/StaticMappers/CustomAttributes/GroupMapper.php(16): Piggy\Api\Models\CustomAttributes\Group->__construct(NULL, 'profile', 1, NULL)
#1 /Users/jayden/Code/piggy/apps/plugin/vendor/piggy/piggy-php-sdk/src/StaticMappers/CustomAttributes/CustomAttributeMapper.php(15): Piggy\Api\StaticMappers\CustomAttributes\GroupMapper::map(Object(stdClass))
#2 /Users/jayden/Code/piggy/apps/plugin/vendor/piggy/piggy-php-sdk/src/StaticMappers/CustomAttributes/CustomAttributesMapper.php(12): Piggy\Api\StaticMappers\CustomAttributes\CustomAttributeMapper::map(Object(st in /Users/jayden/Code/piggy/apps/plugin/vendor/piggy/piggy-php-sdk/src/Models/CustomAttributes/Group.php on line 27

I'm running this version of the SDK: "piggy/piggy-php-sdk": "^3.5"

@iDiegoNL iDiegoNL self-assigned this Jul 4, 2024
@iDiegoNL
Copy link
Member

Thanks for reporting this issue! This has been fixed in the latest SDK release (3.7.0).

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