Improve mapRelatives in BaseObject#49
Merged
Merged
Conversation
mapRelatives doesn't really supports initializing inner properties So for example we get webhook update. Message is transformed to object of Message class, but 'from' and 'chat' fields are not. This code fixes it. I am not sure if you need that continue, but second if does all the job.
Closed
Owner
|
Hi @alexsoft, Thanks for opening the PR. The way Here's an example of how it would work with a webhook setup: $update = Telegram::getWebhookUpdates();
$message = $update->getMessage(); // Maps to Message Object
$from = $message->getFrom(); // Maps to User Object
$chat = $message->getChat(); // Maps to Chat ObjectEdit: For webhook this is definitely a good improvement and can be considered applying, But for manual fetching with maybe a good chunk of backlog messages, I'm concerned about its performance. Let me test this and I'll merge soon. Thanks! |
irazasyed
added a commit
that referenced
this pull request
Nov 25, 2015
Improve mapRelatives in BaseObject
Owner
|
I tested and it's not much of a difference but the improvement is still good. I noticed we could also use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@irazasyed mapRelatives doesn't really supports initializing inner properties
So for example we get webhook update. Message is transformed to object of Message class, but 'from' and 'chat' fields are not.
This code fixes it. I am not sure if you need that continue, but second if does all the job.