[Release v1.0] Add missing query builder methods, api resources, and other improvements#14
Conversation
0f69538 to
3a5b8fd
Compare
| if (!Utils::is_assoc_array($obj)) { | ||
| $obj = ['object'=>'list', 'values'=>$obj]; | ||
| } | ||
| if ($obj instanceof ARMObject) { |
There was a problem hiding this comment.
If we're converting the $obj parameter to an array/list on line 199, wouldn't this if condition never be called?
There was a problem hiding this comment.
We're only converting it to an array/list if it's a regular array instead of a associative array
| private static $_object_cache = []; | ||
| private static $_registry = []; | ||
| public static $spec = []; | ||
| public static $default_params = null; |
There was a problem hiding this comment.
Could be wrong here but in looking at how static properties/inheritance work in PHP, it looks like if we set this on a subclass it will then set it for every other subclass, which it looks like the test here is doing - is that something we want to happen?
There was a problem hiding this comment.
Oh yea, looks like that's right. Awesome find, will fix.
|
In |
…ame static property
Description
Major update to the Payload PHP SDK bringing it up to parity with the Node.js SDK. Adds missing query builder methods, new API resource classes, improved subclass discovery, and reorganized tests.
Changes include:
order_by,limit, andoffsetmethods toARMRequestandARMObjectfor query buildingdefault_paramssupport onARMObjectsubclasses, applied automatically to requests (user params take precedence)InvoiceAttachment,WebhookLog, andLedgerAPI resource classesget_declared_classes()subclass scan inUtils::data2objectwith a lazy-loading registry onARMObjectthat auto-discovers all classes viaglob(__DIR__)+require_oncegroup_byinARMRequestincorrectly writing tofieldsparam instead ofgroup_byARMObjectto use_build_requesthelper for consistent request constructionARMRequestproperties explicitly (PHP 8.2+ compatibility)include()torequire_once()for Exceptions loadingTests/UnitandTests/IntdirectoriesQueryParamsTestunit tests coveringorder_by,limit,offset, chaining, anddefault_paramsphpcbfcode formatting across all filesType of change
Potential breaking change
Utils::data2objectnow uses a lazy-loading registry that auto-discovers all class files in thePayload/directory viaglob()+require_once. Previously, if a class file wasn't explicitly loaded, nested objects of that type would be left as plain associative arrays. Now all classes are always loaded, so nested objects will be deserialized into class instances where they previously may have remained arrays. Any code that accesses nested objects using array syntax (e.g.$val['key']) instead of property access (e.g.$val->key) may break.