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

From response unable to handle items in response #87

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/API/Resources/ResourceEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ResourceEntity extends DataTransferObject
public ?string $officeExtension;
public ?string $officePhone;
public int $payrollType;
public ?string $payrollIdentifier;
public string $resourceType;
public ?int $suffix;
public ?float $surveyResourceRating;
Expand Down
5 changes: 5 additions & 0 deletions src/API/TicketAttachments/TicketAttachmentEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public static function fromResponse(Response $response)
{
$responseArray = json_decode($response->getBody(), true);

//findByID method returns $responseArray["items"], but there should always only be 1 item returned from the API by ID.
if(isset($responseArray["items"]) && is_array($responseArray["items"]) && count($responseArray["items"]) == 1){
return new self($responseArray["items"][0]);
}

if (isset($responseArray['item']) === false) {
throw new \Exception('Missing item key in response.');
}
Expand Down