MetaFox

FeedRepository extends AbstractRepository
in package
implements FeedRepositoryInterface Uses IsFriendTrait, HasSponsor

Class FeedRepository.

Tags
SuppressWarnings

(PHPMD.CouplingBetweenObjects)

SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.ExcessiveClassComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

Table of Contents

Interfaces

FeedRepositoryInterface
Interface FeedRepositoryInterface.

Properties

$model  : Feed
$disableSponsor  : mixed
$historyRepository  : ActivityHistoryRepositoryInterface
$skipPresenter  : mixed

Methods

__construct()  : mixed
allowReviewTag()  : bool
approvePendingFeed()  : array<int, mixed>
approvePendingFeeds()  : void
archiveFeed()  : bool
buildQueryScopes()  : mixed
canAddFriend()  : bool
checkSpamStatus()  : bool
cleanContent()  : string|null
cleanTitle()  : string|null
countFeed()  : int
countFeedPendingOnOwner()  : int
countPinnedFeeds()  : int
countTotalFriend()  : int
countTotalFriendRequest()  : int
countTotalMutualFriend()  : int
createFeed()  : array<string, mixed>
Create a feed (activity post).
createMany()  : bool
declinePendingFeed()  : bool
deleteFeed()  : bool
Delete a feed.
deleteFeedByUserAndOwner()  : void
disableSponsor()  : void
enableSponsor()  : void
find()  : Feed
getFeed()  : Feed
Get feed detail.
getFeedByItem()  : Feed
getFeedByItemId()  : Feed|null
getFeedForEdit()  : Feed
getFeeds()  : array<string|int, Feed>|Collection
Get main activity feeds.
getMissingContentFeed()  : Collection
getModel()  : Feed
getOwnerPrivacyDetail()  : array<string|int, mixed>
getPinnedFeedIds()  : array<string|int, mixed>
getPinnedFeeds()  : Collection
getPrivacyDetail()  : array<string|int, mixed>
getPrivacyIds()  : array<string|int, mixed>
getRandomSponsoredItems()  : Collection
getSpamStatusSetting()  : int
getSponsoredItem()  : Content|null
getSponsorPriceForPayment()  : float|null
getTaggedFriend()  : mixed
getTaggedFriendItems()  : array<string|int, mixed>
getTaggedFriends()  : LengthAwarePaginator
getUserContractMorphTypeColumns()  : array<string|int, string>
handlePutToTagStream()  : mixed
handleRemoveNotification()  : void
hasNewFeeds()  : bool
hasSponsorView()  : bool
hideFeed()  : bool
Hide a feed.
isFriend()  : bool
isNoSponsorView()  : bool
isSponsor()  : bool
likeOperator()  : string
return the case-insensitive LIKE operator bases on the current database driver.
model()  : string
pinFeed()  : bool
pushFeedOnTop()  : bool
removeTagFriend()  : bool
sponsor()  : bool
sponsorFeed()  : bool
unHideFeed()  : bool
UnHide a feed.
unPinFeed()  : bool
unsponsor()  : bool
updateFeed()  : Feed
Update a feed.
updateFeedPrivacy()  : Feed
Update feed privacy.
where()  : $this
withUserMorphTypeActiveScope()  : self
collectIcons()  : array<string|int, mixed>
getDefaultPrivacyDetail()  : array<string|int, mixed>
getSponsorPriceValue()  : array<string|int, mixed>
handleCreateHistory()  : ActivityHistory|null
handlePrivacyDetail()  : array<string|int, mixed>
hasNewPinnedFeeds()  : bool
filterPinnedFeedPrivacy()  : Collection
getStreamManager()  : StreamManagerInterface
shareRepository()  : ShareRepositoryInterface

Properties

Methods

allowReviewTag()

public allowReviewTag(User $context, Feed $feed, array<string|int, mixed> $params) : bool
Parameters
$context : User
$feed : Feed
$params : array<string|int, mixed>
Return values
bool

approvePendingFeed()

public approvePendingFeed(User $context, int $id) : array<int, mixed>
Parameters
$context : User
$id : int
Tags
throws
AuthorizationException
Return values
array<int, mixed>

the returned array should be as format array($data, $extra, $message)

approvePendingFeeds()

public approvePendingFeeds(User $user, User $owner) : void
Parameters
$user : User
$owner : User
Tags
inheritDoc
throws
AuthorizationException

archiveFeed()

public archiveFeed(User $context, int $id) : bool
Parameters
$context : User
$id : int
Tags
throws
AuthorizationException
Return values
bool

buildQueryScopes()

public buildQueryScopes(mixed $query, mixed $model, mixed $criteria) : mixed
Parameters
$query : mixed
$model : mixed
$criteria : mixed

canAddFriend()

public canAddFriend(User $context[, User|null $user = null ]) : bool
Parameters
$context : User
$user : User|null = null
Return values
bool

checkSpamStatus()

public checkSpamStatus(User $user, string $itemType, string|null $content[, int|null $itemId = null ]) : bool
Parameters
$user : User
$itemType : string
$content : string|null
$itemId : int|null = null
Return values
bool

cleanContent()

public cleanContent(string|null $string) : string|null
Parameters
$string : string|null
Return values
string|null

cleanTitle()

public cleanTitle(string|null $string) : string|null
Parameters
$string : string|null
Return values
string|null

countFeed()

public countFeed(string $ownerType, int $ownerId[, string|null $status = MetaFoxConstant::ITEM_STATUS_APPROVED ][, int|null $userId = null ]) : int
Parameters
$ownerType : string
$ownerId : int
$status : string|null = MetaFoxConstant::ITEM_STATUS_APPROVED
$userId : int|null = null
Return values
int

countFeedPendingOnOwner()

public countFeedPendingOnOwner(User $context, User $owner) : int
Parameters
$context : User
$owner : User
Return values
int

countPinnedFeeds()

public countPinnedFeeds(User $context) : int
Parameters
$context : User
Return values
int

countTotalFriend()

public countTotalFriend(int $userId) : int
Parameters
$userId : int
Return values
int

countTotalFriendRequest()

public countTotalFriendRequest(User $user) : int
Parameters
$user : User
Return values
int

countTotalMutualFriend()

public countTotalMutualFriend(int $contextId, int $userId) : int
Parameters
$contextId : int
$userId : int
Return values
int

createFeed()

Create a feed (activity post).

public createFeed(User $context, User $user, User $owner, array<string|int, mixed> $params) : array<string, mixed>
Parameters
$context : User
$user : User
$owner : User
$params : array<string|int, mixed>
Tags
SuppressWarnings

(PHPMD.ExcessiveMethodLength)

SuppressWarnings

(PHPMD.NPathComplexity)

throws
AuthorizationException
inheritDoc
Return values
array<string, mixed>

createMany()

public createMany(array<string|int, mixed> $items) : bool
Parameters
$items : array<string|int, mixed>
Return values
bool

declinePendingFeed()

public declinePendingFeed(User $context, int $id, array<string|int, mixed> $params) : bool
Parameters
$context : User
$id : int
$params : array<string|int, mixed>
Return values
bool

deleteFeed()

Delete a feed.

public deleteFeed(User $user, int $id) : bool
Parameters
$user : User
$id : int
Return values
bool

find()

public find(mixed $id, mixed $columns) : Feed
Parameters
$id : mixed
$columns : mixed
Return values
Feed

getFeedByItem()

public getFeedByItem(User|null $context, Entity|null $content[, string|null $typeId = null ]) : Feed
Parameters
$context : User|null
$content : Entity|null
$typeId : string|null = null
Return values
Feed

getFeedByItemId()

public getFeedByItemId(User $context, int $itemId, string $itemType, string $typeId[, bool $checkPermission = true ]) : Feed|null
Parameters
$context : User
$itemId : int
$itemType : string
$typeId : string
$checkPermission : bool = true
Return values
Feed|null

getFeeds()

Get main activity feeds.

public getFeeds(User $user[, User|null $owner = null ][, int|null $lastFeedId = null ][, int $need = Pagination::DEFAULT_ITEM_PER_PAGE ][, string|null $hashtag = null ][, bool $friendOnly = false ][, array<string|int, mixed>|null $extraConditions = null ][, string|null $sort = Browse::SORT_RECENT ][, string|null $sortType = MetaFoxConstant::SORT_DESC ][, bool $getFeedSponsor = false ][, array<string|int, mixed>|null $status = null ][, bool $isPreviewTag = false ][, array<string|int, mixed>|null $loadedSponsoredFeedIds = null ][, array<string|int, mixed> $params = [] ]) : array<string|int, Feed>|Collection
Parameters
$user : User
$owner : User|null = null
$lastFeedId : int|null = null
$need : int = Pagination::DEFAULT_ITEM_PER_PAGE
$hashtag : string|null = null
$friendOnly : bool = false
$extraConditions : array<string|int, mixed>|null = null
$sort : string|null = Browse::SORT_RECENT
$sortType : string|null = MetaFoxConstant::SORT_DESC
$getFeedSponsor : bool = false
$status : array<string|int, mixed>|null = null
$isPreviewTag : bool = false
$loadedSponsoredFeedIds : array<string|int, mixed>|null = null
$params : array<string|int, mixed> = []
Tags
inherhitDoc
SuppressWarnings

(PHPMD.BooleanArgumentFlag)

SuppressWarnings

(PHPMD.ExcessiveParameterList)

Return values
array<string|int, Feed>|Collection

getMissingContentFeed()

public getMissingContentFeed(string $typeId) : Collection
Parameters
$typeId : string
Return values
Collection

getOwnerPrivacyDetail()

public getOwnerPrivacyDetail(User $context, User $resource[, int|null $representativePrivacy = null ]) : array<string|int, mixed>
Parameters
$context : User
$resource : User
$representativePrivacy : int|null = null
Return values
array<string|int, mixed>

getPinnedFeedIds()

public getPinnedFeedIds(User $context) : array<string|int, mixed>
Parameters
$context : User
Return values
array<string|int, mixed>

getPrivacyDetail()

public getPrivacyDetail(User $context, Content $resource[, int|null $representativePrivacy = null ]) : array<string|int, mixed>
Parameters
$context : User
$resource : Content
$representativePrivacy : int|null = null
Return values
array<string|int, mixed>

getPrivacyIds()

public getPrivacyIds(User $owner, Feed $feed) : array<string|int, mixed>
Parameters
$owner : User
$feed : Feed
Return values
array<string|int, mixed>

getRandomSponsoredItems()

public getRandomSponsoredItems(User $context, int $limit[, array<string|int, mixed>|null $loadedItemIds = null ]) : Collection
Parameters
$context : User
$limit : int
$loadedItemIds : array<string|int, mixed>|null = null
Return values
Collection

getSpamStatusSetting()

public getSpamStatusSetting() : int
Return values
int

getSponsoredItem()

public getSponsoredItem(array<string|int, mixed> $notInIds[, int|null $sponsorStart = null ][, array<string|int, mixed> $with = [] ]) : Content|null
Parameters
$notInIds : array<string|int, mixed>
$sponsorStart : int|null = null
$with : array<string|int, mixed> = []
Return values
Content|null

getSponsorPriceForPayment()

public getSponsorPriceForPayment(User $user[, string|null $currencyId = null ]) : float|null
Parameters
$user : User
$currencyId : string|null = null
Return values
float|null

getTaggedFriendItems()

public getTaggedFriendItems(HasTaggedFriend $item[, int $limit = 10 ]) : array<string|int, mixed>
Parameters
$item : HasTaggedFriend
$limit : int = 10
Tags
throws
AuthorizationException
Return values
array<string|int, mixed>

getTaggedFriends()

public getTaggedFriends(int $itemId, string $itemType, int $limit[, array<string|int, mixed> $excludedIds = [] ]) : LengthAwarePaginator
Parameters
$itemId : int
$itemType : string
$limit : int
$excludedIds : array<string|int, mixed> = []
Return values
LengthAwarePaginator

getUserContractMorphTypeColumns()

public getUserContractMorphTypeColumns() : array<string|int, string>
Return values
array<string|int, string>

handlePutToTagStream()

public handlePutToTagStream(User $context, User $friend, int $itemId, string $itemType, string $typeId) : mixed
Parameters
$context : User
$friend : User
$itemId : int
$itemType : string
$typeId : string
Tags
inheritDoc
throws
AuthorizationException

handleRemoveNotification()

public handleRemoveNotification(string $notificationType, int $itemId, string $itemType) : void
Parameters
$notificationType : string
$itemId : int
$itemType : string

hasNewFeeds()

public hasNewFeeds(User $context[, int $lastFeedId = 0 ][, int $lastPinFeedId = 0 ][, User|null $owner = null ][, string|null $sort = null ][, int $lastSponsoredFeedId = 0 ]) : bool
Parameters
$context : User
$lastFeedId : int = 0
$lastPinFeedId : int = 0
$owner : User|null = null
$sort : string|null = null
$lastSponsoredFeedId : int = 0
Tags
throws
AuthorizationException
Return values
bool

hasSponsorView()

public hasSponsorView(array<string|int, mixed> $attributes) : bool
Parameters
$attributes : array<string|int, mixed>
Return values
bool

isFriend()

public isFriend(User $context[, User|null $user = null ]) : bool
Parameters
$context : User
$user : User|null = null
Return values
bool

isNoSponsorView()

public isNoSponsorView(string|null $view) : bool
Parameters
$view : string|null
Return values
bool

likeOperator()

return the case-insensitive LIKE operator bases on the current database driver.

public likeOperator() : string
Return values
string

pinFeed()

public pinFeed(User $context, User|null $owner, int $feedId) : bool
Parameters
$context : User
$owner : User|null
$feedId : int
Return values
bool

pushFeedOnTop()

public pushFeedOnTop(int $feedId) : bool
Parameters
$feedId : int
Tags
todo:

need to rework to implement mechanism

Return values
bool

removeTagFriend()

public removeTagFriend(Feed $feed) : bool
Parameters
$feed : Feed
Tags
inheritDoc
throws
AuthorizationException
Return values
bool

sponsor()

public sponsor(User $context, int $id, int $sponsor) : bool
Parameters
$context : User
$id : int
$sponsor : int
Tags
throws
AuthenticationException
throws
AuthorizationException
Return values
bool

sponsorFeed()

public sponsorFeed(User $context, Feed $feed, int $sponsor) : bool
Parameters
$context : User
$feed : Feed
$sponsor : int
Tags
throws
AuthorizationException
Return values
bool

unPinFeed()

public unPinFeed(User $context, User|null $owner, int $id) : bool
Parameters
$context : User
$owner : User|null
$id : int
Return values
bool

unsponsor()

public unsponsor(User $context, int $id) : bool
Parameters
$context : User
$id : int
Return values
bool

updateFeed()

Update a feed.

public updateFeed(User $context, User $user, int $id, array<string, mixed> $params) : Feed
Parameters
$context : User
$user : User
$id : int
$params : array<string, mixed>
Tags
throws
AuthorizationException
SuppressWarnings

(PHPMD.ExcessiveMethodLength)

todo:

need to clean up the process of update feed and its item? (too much dependency)

Return values
Feed

updateFeedPrivacy()

Update feed privacy.

public updateFeedPrivacy(User $context, Feed $feed, array<string, mixed> $params) : Feed
Parameters
$context : User
$feed : Feed
$params : array<string, mixed>
Tags
throws
AuthorizationException
throws
AuthenticationException
Return values
Feed

where()

public where(array<string|int, mixed> $params) : $this
Parameters
$params : array<string|int, mixed>
Tags
throws
RepositoryException
Return values
$this

withUserMorphTypeActiveScope()

public withUserMorphTypeActiveScope() : self
Return values
self

collectIcons()

protected collectIcons() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDefaultPrivacyDetail()

protected getDefaultPrivacyDetail(int $privacy[, User|null $context = null ][, User|null $owner = null ]) : array<string|int, mixed>
Parameters
$privacy : int
$context : User|null = null
$owner : User|null = null
Return values
array<string|int, mixed>

getSponsorPriceValue()

protected getSponsorPriceValue([int|null $roleId = null ]) : array<string|int, mixed>
Parameters
$roleId : int|null = null
Return values
array<string|int, mixed>

handleCreateHistory()

protected handleCreateHistory(User $user, Feed $feed, bool $hasUpdateContent, string $postType[, bool $isPhrase = false ]) : ActivityHistory|null
Parameters
$user : User
$feed : Feed
$hasUpdateContent : bool
$postType : string
$isPhrase : bool = false
Return values
ActivityHistory|null

handlePrivacyDetail()

protected handlePrivacyDetail(User $context, Content $resource, User|null $owner[, int|null $representativePrivacy = null ]) : array<string|int, mixed>
Parameters
$context : User
$resource : Content
$owner : User|null
$representativePrivacy : int|null = null
Return values
array<string|int, mixed>

hasNewPinnedFeeds()

protected hasNewPinnedFeeds(User $context, int $lastPinFeedId[, User|null $owner = null ]) : bool
Parameters
$context : User
$lastPinFeedId : int
$owner : User|null = null
Return values
bool

filterPinnedFeedPrivacy()

private filterPinnedFeedPrivacy(User $user, Collection $feeds, array<string|int, mixed> $pinnedFeedIds) : Collection
Parameters
$user : User
$feeds : Collection
$pinnedFeedIds : array<string|int, mixed>
Return values
Collection

        
On this page

Search results