Class humhub\modules\space\models\Membership

Inheritancehumhub\modules\space\models\Membership » humhub\components\ActiveRecord » yii\db\ActiveRecord
ImplementsSerializable
Subclasseshumhub\modules\space\modules\manage\models\MembershipSearch

This is the model class for table "space_membership".

Public Methods

Hide inherited methods

MethodDescriptionDefined By
attributeLabels() humhub\modules\space\models\Membership
beforeDelete() humhub\modules\space\models\Membership
beforeSave() humhub\modules\space\models\Membership
countNewItems() Counts all new Items for this membership humhub\modules\space\models\Membership
findByUser() Returns an ActiveQuery selcting all memberships for the given $user. humhub\modules\space\models\Membership
getCreatedBy() Relation to User defined in created_by attribute humhub\components\ActiveRecord
getErrorMessage() Returns the errors as string for all attribute or a single attribute. humhub\components\ActiveRecord
getFileManager() Returns the file manager for this record humhub\components\ActiveRecord
getOriginator() humhub\modules\space\models\Membership
getSpace() humhub\modules\space\models\Membership
getSpaceMembersQuery() Returns a user query for space memberships humhub\modules\space\models\Membership
getUniqueId() Returns a unique id for this record/model humhub\components\ActiveRecord
getUpdatedBy() Relation to User defined in updated_by attribute humhub\components\ActiveRecord
getUser() humhub\modules\space\models\Membership
getUserSpaceIds() Returns a list of all spaces' ids of the given userId humhub\modules\space\models\Membership
getUserSpaceQuery() Returns Space for user space membership humhub\modules\space\models\Membership
getUserSpaces() Returns a list of all spaces of the given userId humhub\modules\space\models\Membership
isCurrentUser() Checks if the current logged in user is the related user of this membership record. humhub\modules\space\models\Membership
isMember() Determines if this membership is a full accepted membership. humhub\modules\space\models\Membership
rules() humhub\modules\space\models\Membership
serialize() Serializes attributes and oldAttributes of this record. humhub\components\ActiveRecord
tableName() humhub\modules\space\models\Membership
unserialize() Unserializes the given string, calls the init() function and sets the attributes and oldAttributes. humhub\components\ActiveRecord
updateLastVisit() Update last visit humhub\modules\space\models\Membership

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
STATUS_APPLICANT 2 humhub\modules\space\models\Membership
STATUS_INVITED 1 Status Codes humhub\modules\space\models\Membership
STATUS_MEMBER 3 humhub\modules\space\models\Membership
USER_SPACEIDS_CACHE_KEY 'userSpaceIds_' humhub\modules\space\models\Membership
USER_SPACES_CACHE_KEY 'userSpaces_' humhub\modules\space\models\Membership

Method Details

attributeLabels() public method

public void attributeLabels ( )
beforeDelete() public method

public void beforeDelete ( )
beforeSave() public method

public void beforeSave ( $insert )
$insert
countNewItems() public method

Counts all new Items for this membership

public void countNewItems ( )
findByUser() public static method (available since version 1.2)

Returns an ActiveQuery selcting all memberships for the given $user.

public static \yii\db\ActiveQuery findByUser ( humhub\modules\user\models\User $user null, $membershipStatus self::STATUS_MEMBER, $spaceStatus = \humhub\modules\space\models\Space::STATUS_ENABLED )
$user humhub\modules\user\models\User
$membershipStatus integer

The status of the Space by default self::STATUS_MEMBER.

$spaceStatus integer

The status of the Space by default Space::STATUS_ENABLED.

getOriginator() public method

public void getOriginator ( )
getSpace() public method

public void getSpace ( )
getSpaceMembersQuery() public static method (available since version 1.1)

Returns a user query for space memberships

public static humhub\modules\user\components\ActiveQueryUser getSpaceMembersQuery ( humhub\modules\space\models\Space $space, $membersOnly true, $withNotifications null )
$space humhub\modules\space\models\Space
$membersOnly boolean

Only return approved members

$withNotifications boolean|null

Include only memberships with sendNotification setting

getUser() public method

public void getUser ( )
getUserSpaceIds() public static method (available since version 1.2.5)

Returns a list of all spaces' ids of the given userId

public static void getUserSpaceIds ( $userId '' )
$userId integer
getUserSpaceQuery() public static method (available since version 1.0)

Returns Space for user space membership

public static \yii\db\ActiveQuery getUserSpaceQuery ( humhub\modules\user\models\User $user, $memberOnly true, $withNotifications null )
$user humhub\modules\user\models\User
$memberOnly boolean

Include only member status - no pending/invite states

$withNotifications boolean|null

Include only memberships with sendNotification setting

return \yii\db\ActiveQuery

For space model

getUserSpaces() public static method

Returns a list of all spaces of the given userId

public static humhub\modules\space\models\Space[] getUserSpaces ( $userId '', $cached true )
$userId integer|string

The user id or empty for current user

$cached boolean

Use cached result if available

return humhub\modules\space\models\Space[]

An array of spaces

isCurrentUser() public method (available since version 1.3.9)

Checks if the current logged in user is the related user of this membership record.

public boolean isCurrentUser ( )
isMember() public method

Determines if this membership is a full accepted membership.

public boolean isMember ( )
rules() public method

public void rules ( )
tableName() public static method

public static void tableName ( )
updateLastVisit() public method

Update last visit

public void updateLastVisit ( )

Event Details

EVENT_MEMBER_ADDED event of type humhub\modules\space\MemberEvent
EVENT_MEMBER_REMOVED event of type humhub\modules\space\MemberEvent