-
Notifications
You must be signed in to change notification settings - Fork 132
Do not require to pass the full user object when only the ID is required #541
Conversation
@@ -1,5 +1,7 @@ | |||
<?php | |||
|
|||
declare(strict_types = 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious to see if this will break any beta blockers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me too, that's why I added it, in the current code base all tests are passing with strict types! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good.
I suppose that for the beta1 release we'll add the following BC breaking change?
from:
public function isMemberPending(EntityInterface $group, $user_id) {
into:
public function isMemberPending(EntityInterface $group, int $user) {
Thanks for the review! I agree that we can make the change to the |
Wow we have a lot of cases where a string is returned from I am not sure now about requiring integers, this will be too much of a hassle for developers to always cast to an integer. Let's for now keep the documentation as integer, but not enforce it until core is more strict about its data types. I will remove the strict check on the B/C layer. |
The core entity API often returns the user ID as a string value even though it is defined as an integer in the base field definitions. Let's wait until core is more strict about returning the right data type.
This is part of #487
Most of the methods in the
MembershipManager
service that deal with users require the full user object to be passed in, but only require the user ID to operate. This requires the calling code to needlessly load the full user entity from the database while they could simply pass in the entity ID.This PR provides a B/C layer so that existing code keeps working for now.