Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

MembershipManager::getMemberships() and getMembership() don't document how to get all states #335

Closed
joachim-n opened this issue Oct 30, 2017 · 4 comments

Comments

@joachim-n
Copy link

   * @param array $states
   *   (optional) Array with the state to return. Defaults to active.

This doesn't tell me how to get all states.

Looking at the code, an empty array will do it.

@joachim-n
Copy link
Author

Revisiting this, it occurs to me that a new constant OgMembershipInterface::STATE_ANY would be clearer.

@amitaibu
Copy link
Member

OgMembershipInterface::STATE_ANY sounds like a good idea.

@pfrenssen
Copy link
Contributor

Instead of a new string constant, how about defining an array constant OgMembershipInterface::STATES that contains the available states?

  /**
   * An array containing all possible group membership states.
   */
  const STATES = [self::STATE_ACTIVE, self::STATE_PENDING, self::STATE_BLOCKED];

This would be clearer and easier to implement I think. It also has use cases wherever you need to consult or loop over the full list of states in code.

@amitaibu
Copy link
Member

Yeah, I like this STATES const better

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants