Skip to content

Smarten up subEntities and return empty array for Entity items #969

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

Merged

Conversation

noplanman
Copy link
Member

This PR cuts away a lot of bulky code and makes the sub entity generation smarter, i.e.

protected function subEntities()
{
    return [
        'data'        => [EncryptedPassportElement::class], // Will return an array of objects of this type.
        'credentials' => EncryptedCredentials::class,       // Will return a single object of this type
    ];
}

@php-telegram-bot/developers Have I missed anything by making this change? I think it's just so much more logical and easier to understand this way. And it makes the code more DRY, removing all the excessive bulk of identical methods.

@noplanman noplanman requested a review from a team June 11, 2019 21:03
Copy link
Member

@akalongman akalongman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to test this manually after merging

@noplanman noplanman merged commit c8329d6 into php-telegram-bot:develop Jun 15, 2019
@noplanman noplanman deleted the return_empty_array_for_items branch June 15, 2019 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants