UserPrivacyRepository
        
        extends AbstractRepository
    
    
            
            in package
            
        
    
            
            implements
                            UserPrivacyRepositoryInterface                    
    
            
            Uses
                            CollectItemPrivacySetting,                             CollectProfilePrivacySetting,                             CollectProfileMenuPrivacySetting                    
    
Class UserPrivacyRepository.
Table of Contents
Interfaces
- UserPrivacyRepositoryInterface
 - Interface UserPrivacy.
 
Constants
- CACHE_LIFETIME = 3000
 - CACHE_NAME_USER_PRIVACY = 'user_privacy'
 - CACHE_NAME_USER_PRIVACY_TYPES = 'user_privacy_types'
 
Properties
- $model : UserPrivacy
 - $disableSponsor : mixed
 - $skipPresenter : mixed
 
Methods
- buildQueryScopes() : mixed
 - cleanContent() : string|null
 - cleanTitle() : string|null
 - collectItemPrivacySetting() : array<string, mixed>
 - Collect {resource_name}.item_privacy.
 - collectProfileMenuSetting() : array<string, mixed>
 - Collect {resource_name}.profile_menu.
 - collectProfilePrivacySettingByEntity() : array<string|int, mixed>
 - convertPrivacySettingName() : string
 - createMany() : bool
 - deleteUserPrivacy() : int
 - Delete user privacy when deleting a user.
 - getBirthdayOptionsForForm() : array<string, mixed>
 - getBirthdaySetting() : array<string, mixed>
 - Get Date of Birth setting of an user.
 - getItemPrivacySettings() : array<int, mixed>
 - Get Item default privacy list of an user. [ setting_name => 0 ].
 - getItemPrivacySettingsForValidate() : array<string, mixed>
 - getModel() : UserPrivacy
 - getPrivacyTypes() : array<string, mixed>
 - getPrivacyTypesByEntity() : array<string, mixed>
 - getProfileMenuSettings() : array<int, mixed>
 - Get profile menu setting of an user. [ setting_name => 0 ].
 - getProfileMenuSettingsForValidate() : array<string, mixed>
 - getProfileSettings() : array<int, mixed>
 - Get profile setting of an user. Support page/group/ v.v... [ setting_name => 0 ].
 - getProfileSettingsForValidate() : array<string, mixed>
 - getUserContractMorphTypeColumns() : array<string|int, string>
 - getUserPrivacy() : array<string, mixed>
 - Get user privacy.
 - getUserPrivacyByName() : UserPrivacy|null
 - hasSponsorView() : bool
 - installPrivacyTypes() : void
 - Install privacy types.
 - isNoSponsorView() : bool
 - likeOperator() : string
 - return the case-insensitive LIKE operator bases on the current database driver.
 - mapUserPrivacy() : array<string, mixed>
 - 1. Collect all app first.
 - model() : string
 - updatePrivacyResourceValueByEntity() : void
 - Update user privacy resource value by entity type.
 - updateUserPrivacy() : array<string, mixed>
 - Update user privacy.
 - where() : $this
 - withUserMorphTypeActiveScope() : self
 - massCollect() : array<string, array<string, mixed>>
 - Mass collect from all packages.
 - collectProfilePrivacySetting() : array<string, mixed>
 - This method will help you collect all privacy belongs to a resource.
 - collectUserPrivacyType() : array<string, mixed>
 - Collect raw data from app user privacy settings.
 - updatePrivacyResourceByName() : void
 - updatePrivacyType() : void
 
Constants
CACHE_LIFETIME
    public
        mixed
    CACHE_LIFETIME
    = 3000
    
    
    
CACHE_NAME_USER_PRIVACY
    public
        mixed
    CACHE_NAME_USER_PRIVACY
    = 'user_privacy'
    
    
    
CACHE_NAME_USER_PRIVACY_TYPES
    public
        mixed
    CACHE_NAME_USER_PRIVACY_TYPES
    = 'user_privacy_types'
    
    
    
Properties
$model
    public
        UserPrivacy
    $model
    
    
    
    
$disableSponsor
    protected
        mixed
    $disableSponsor
    
    
    
    
$skipPresenter
    protected
        mixed
    $skipPresenter
     = true
    
    
    
Methods
buildQueryScopes()
    public
                    buildQueryScopes(mixed $query, mixed $model, mixed $criteria) : mixed
    Parameters
- $query : mixed
 - $model : mixed
 - $criteria : mixed
 
cleanContent()
    public
                    cleanContent(string|null $string) : string|null
    Parameters
- $string : string|null
 
Return values
string|nullcleanTitle()
    public
                    cleanTitle(string|null $string) : string|null
    Parameters
- $string : string|null
 
Return values
string|nullcollectItemPrivacySetting()
Collect {resource_name}.item_privacy.
    public
                    collectItemPrivacySetting() : array<string, mixed>
    [ 'privacy_name' => [ 'phrase' => 'abc', 'default' => 0, 'list' => [ 0 => Everyone, 1 => Friend, ] ] ].
Return values
array<string, mixed>collectProfileMenuSetting()
Collect {resource_name}.profile_menu.
    public
                    collectProfileMenuSetting() : array<string, mixed>
    [ 'privacy_name' => [ 'phrase' => 'abc', 'default' => 0, 'list' => [ 0 => Everyone, 1 => Friend, ] ] ].
Return values
array<string, mixed>collectProfilePrivacySettingByEntity()
    public
                    collectProfilePrivacySettingByEntity(string $entityType) : array<string|int, mixed>
    Parameters
- $entityType : string
 
Return values
array<string|int, mixed>convertPrivacySettingName()
    public
                    convertPrivacySettingName(string $privacyName) : string
    Parameters
- $privacyName : string
 
Return values
stringcreateMany()
    public
                    createMany(array<string|int, mixed> $items) : bool
    Parameters
- $items : array<string|int, mixed>
 
Return values
booldeleteUserPrivacy()
Delete user privacy when deleting a user.
    public
                    deleteUserPrivacy(int $userId) : int
    Parameters
- $userId : int
 
Return values
intgetBirthdayOptionsForForm()
    public
                    getBirthdayOptionsForForm([bool $isAdmin = false ]) : array<string, mixed>
    Parameters
- $isAdmin : bool = false
 
Return values
array<string, mixed>getBirthdaySetting()
Get Date of Birth setting of an user.
    public
                    getBirthdaySetting(User $user) : array<string, mixed>
    Parameters
- $user : User
 
Tags
Return values
array<string, mixed>getItemPrivacySettings()
Get Item default privacy list of an user. [ setting_name => 0 ].
    public
                    getItemPrivacySettings(int $userId) : array<int, mixed>
    Parameters
- $userId : int
 
Return values
array<int, mixed>getItemPrivacySettingsForValidate()
    public
                    getItemPrivacySettingsForValidate(int $userId) : array<string, mixed>
    Parameters
- $userId : int
 
Return values
array<string, mixed>getModel()
    public
                    getModel() : UserPrivacy
    Return values
UserPrivacygetPrivacyTypes()
    public
                    getPrivacyTypes() : array<string, mixed>
    Return values
array<string, mixed>getPrivacyTypesByEntity()
    public
                    getPrivacyTypesByEntity(string $entityType) : array<string, mixed>
    Parameters
- $entityType : string
 
Return values
array<string, mixed>getProfileMenuSettings()
Get profile menu setting of an user. [ setting_name => 0 ].
    public
                    getProfileMenuSettings(int $userId) : array<int, mixed>
    Parameters
- $userId : int
 
Return values
array<int, mixed>getProfileMenuSettingsForValidate()
    public
                    getProfileMenuSettingsForValidate(int $userId) : array<string, mixed>
    Parameters
- $userId : int
 
Return values
array<string, mixed>getProfileSettings()
Get profile setting of an user. Support page/group/ v.v... [ setting_name => 0 ].
    public
                    getProfileSettings(int $userId) : array<int, mixed>
    Parameters
- $userId : int
 
Return values
array<int, mixed>getProfileSettingsForValidate()
    public
                    getProfileSettingsForValidate(int $userId) : array<string, mixed>
    Parameters
- $userId : int
 
Return values
array<string, mixed>getUserContractMorphTypeColumns()
    public
                    getUserContractMorphTypeColumns() : array<string|int, string>
    Return values
array<string|int, string>getUserPrivacy()
Get user privacy.
    public
                    getUserPrivacy(int $userId) : array<string, mixed>
    Parameters
- $userId : int
 
Return values
array<string, mixed>getUserPrivacyByName()
    public
                    getUserPrivacyByName(int $userId, string $name) : UserPrivacy|null
    Parameters
- $userId : int
 - $name : string
 
Return values
UserPrivacy|nullhasSponsorView()
    public
                    hasSponsorView(array<string|int, mixed> $attributes) : bool
    Parameters
- $attributes : array<string|int, mixed>
 
Return values
boolinstallPrivacyTypes()
Install privacy types.
    public
                    installPrivacyTypes() : void
    isNoSponsorView()
    public
                    isNoSponsorView(string|null $view) : bool
    Parameters
- $view : string|null
 
Return values
boollikeOperator()
return the case-insensitive LIKE operator bases on the current database driver.
    public
                    likeOperator() : string
    Return values
stringmapUserPrivacy()
1. Collect all app first.
    public
                    mapUserPrivacy(int $userId, string $userType, array<string, mixed> $privacyCollection) : array<string, mixed>
    - Map to user setting (user_privacy_values).
 - If not, use privacy_default in user_privacy_types.
 
Parameters
- $userId : int
 - $userType : string
 - $privacyCollection : array<string, mixed>
 
Return values
array<string, mixed>model()
    public
                    model() : string
    Return values
stringupdatePrivacyResourceValueByEntity()
Update user privacy resource value by entity type.
    public
                    updatePrivacyResourceValueByEntity(string $entityType, int $value) : void
    Parameters
- $entityType : string
 - $value : int
 
updateUserPrivacy()
Update user privacy.
    public
                    updateUserPrivacy(int $userId, array<string|int, mixed> $params) : array<string, mixed>
    Parameters
- $userId : int
 - $params : array<string|int, mixed>
 - 
                    
[profile.view_profile => 0, profile.profile_info => 0]
 
Return values
array<string, mixed> —[profile.view_profile => 1, profile.profile_info => 1]
where()
    public
                    where(array<string|int, mixed> $params) : $this
    Parameters
- $params : array<string|int, mixed>
 
Tags
Return values
$thiswithUserMorphTypeActiveScope()
    public
                    withUserMorphTypeActiveScope() : self
    Return values
selfmassCollect()
Mass collect from all packages.
    protected
                    massCollect(string $name) : array<string, array<string, mixed>>
    Parameters
- $name : string
 
Return values
array<string, array<string, mixed>>collectProfilePrivacySetting()
This method will help you collect all privacy belongs to a resource.
    private
                    collectProfilePrivacySetting() : array<string, mixed>
    [ 'group' => [ 'privacy_name' => [ 'phrase' => 'abc', 'default' => 0, 'list' => [ MetaFoxPrivacy::EVERYONE, MetaFoxPrivacy::FRIENDS ], ], ], 'page' => [], 'user' => [], ].
Tags
Return values
array<string, mixed>collectUserPrivacyType()
Collect raw data from app user privacy settings.
    private
                    collectUserPrivacyType() : array<string, mixed>
    [ 'profile.view_profile' => [ 'phrase' => 'Who can view your profile page?', 'default' => 0, ], ].
Return values
array<string, mixed>updatePrivacyResourceByName()
    private
                    updatePrivacyResourceByName(string $entityType, string $settingName, array<string, mixed> $value) : void
    Parameters
- $entityType : string
 - $settingName : string
 - $value : array<string, mixed>
 
updatePrivacyType()
    private
                    updatePrivacyType(string $name, int $value) : void
    Parameters
- $name : string
 - $value : int