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

Typed threads when being hydrated #160

Merged
merged 7 commits into from Jun 5, 2019

Conversation

Projects
None yet
3 participants
@bkuhl
Copy link
Contributor

commented Jun 5, 2019

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 #159.

bkuhl added some commits Jun 5, 2019

@bkuhl bkuhl requested a review from ShayCichocki Jun 5, 2019

@wking-io

This comment has been minimized.

Copy link
Contributor

commented Jun 5, 2019

@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:

$threads = $this->loadResources(Thread::class, ConversationLinks::THREADS);

@bkuhl

This comment has been minimized.

Copy link
Contributor Author

commented Jun 5, 2019

@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:

if ($this->shouldLoadResource(ConversationLinks::THREADS)) {

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

$threadFactory = new ThreadFactory();
$threads = $this->loadResources(function (array $data) use ($threadFactory) {
return $threadFactory->make($data['type'], $data);
}, ConversationLinks::THREADS);

This comment has been minimized.

Copy link
@bkuhl

bkuhl Jun 5, 2019

Author Contributor

@tompedals Thanks for making the deserializer accept a closure, that was brilliant :)

@ShayCichocki

This comment has been minimized.

Copy link

commented Jun 5, 2019

Once travis gets cleaned up lgtm!

bkuhl added some commits Jun 5, 2019

@bkuhl bkuhl merged commit 3045599 into master Jun 5, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@bkuhl bkuhl deleted the typed-threads branch Jun 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.