helpscout / helpscout-api-php

PHP Wrapper for the Help Scout API
MIT License
98 stars 62 forks source link

Typed threads when being hydrated #160

Closed bkuhl closed 5 years ago

bkuhl commented 5 years ago

When hydrating a Conversation's threads, we are now casting them to an object that represents their type. The factory in use already has a fallback to use Thread for unrecognized thread types.

This is a follow up PR To https://github.com/helpscout/helpscout-api-php/pull/159.

wking-io commented 5 years ago

@bkuhl was taking a look at what you are working on and noticed that where you are replacing the hydrate with make in the Conversation Class was not where we noticed the threads in a withThreads call was happening. We debugged and noticed that they were happening here too: https://github.com/helpscout/helpscout-api-php/blob/8a13f7eef210be2a4fae30fd9b4fb8f8b406fb80/src/Conversations/ConversationLoader.php#L46

bkuhl commented 5 years ago

@bkuhl was taking a look at what you are working on and noticed that where you are replacing the hydrate with make in the Conversation Class was not where we noticed the threads in a withThreads call was happening. We debugged and noticed that they were happening here too:

https://github.com/helpscout/helpscout-api-php/blob/8a13f7eef210be2a4fae30fd9b4fb8f8b406fb80/src/Conversations/ConversationLoader.php#L45

Thanks for that input. You're right, this only solves part of it.

ShayCichocki commented 5 years ago

Once travis gets cleaned up lgtm!