MetaFox

PinPostManager extends StreamManager
in package

Class StreamManager.

Table of Contents

Properties

$allowSortFields  : array<string, array<string, string|null>>
$select  : array<string|int, string>
$sortMapping  : array<string, string>
$isGreaterThanLastFeed  : bool
$isViewSearchString  : bool
$searchString  : string|null
$additionalConditions  : array<string, mixed>
$continuousTry  : int
$eagerLoads  : array<string|int, string>
$hashtag  : string|null
$isPreviewTag  : bool
$isViewHashtag  : bool
$isViewOnProfile  : bool
$limit  : int
$loadedSponsoredFeedIds  : array<string|int, mixed>|null
$onlyFriends  : bool
$ownerId  : int|null
$pinnedFeedIds  : array<string|int, mixed>
$searchByStreamId  : bool
$sortFields  : array<string, mixed>
$sortType  : string
$sortView  : string
$sponsoredFeedIds  : array<string|int, mixed>
$status  : array<string|int, mixed>|null
$user  : User|null
$userId  : int|null

Methods

__construct()  : mixed
addPinnedFeedIds()  : mixed
addSponsoredFeed()  : void
fetchPinnedFeeds()  : void
Fetch pinned feed into a collections when prepend to collection, we need to keep ordering of lasted pined at first.
fetchSponsoredFeeds()  : array<string|int, mixed>
fetchStream()  : Collection
fetchStreamContinuous()  : void
getEagerLoads()  : array<string|int, mixed>
getFeedSortView()  : array<string|int, mixed>
getHomepageLimit()  : int
getIsGreaterThanLastFeed()  : bool
getLimit()  : int
getOwnerId()  : int|null
getPinnedFeedIds()  : array<string|int, mixed>
getProfileLimit()  : int
getSelect()  : array<string|int, string>
getSortFields()  : array<string, mixed>
getSortType()  : string
getSortView()  : string
getSponsoredFeedLimit()  : int
getStatus()  : string
getUserId()  : int|null
hasAdditionalConditions()  : bool
isApproved()  : StreamManager
isDenied()  : StreamManager
isOnlyFriends()  : bool
isPending()  : StreamManager
isPreviewTag()  : int
isRemoved()  : StreamManager
isSearchByStreamId()  : bool
isViewHashtag()  : bool
isViewOnProfile()  : bool
isViewSearch()  : bool
setAdditionalConditions()  : StreamManager
setHashtag()  : StreamManager
setIsGreaterThanLastFeed()  : $this
setIsViewHashtag()  : StreamManager
setIsViewOnProfile()  : StreamManager
setIsViewSearch()  : $this
setLimit()  : self
setLoadedSponsoredFeedIds()  : $this
setOnlyFriends()  : $this
setOwnerId()  : self
setPreviewTag()  : $this
setSearchByStreamId()  : StreamManager
setSearchString()  : $this
setSelect()  : self
setSortFields()  : self
setStatus()  : StreamManager
setUser()  : $this
setUserId()  : self
toFeeds()  : Collection
Convert from get stream (feed ids) to collection of Feeds.
buildProfileQueryForMember()  : Builder
buildProfileQueryForModeration()  : Builder
buildQuery()  : Builder|null
buildQueryForFriendsOnly()  : void
queryHomeFeed()  : Builder
queryProfileFeed()  : Builder
handleAdditionalConditions()  : Builder

Properties

$allowSortFields

public array<string, array<string, string|null>> $allowSortFields = [ \MetaFox\Platform\Support\Browse\Browse::SORT_RECENT => ['stream.created_at' => \MetaFox\Platform\MetaFoxConstant::SORT_DESC, 'stream.feed_id' => \MetaFox\Platform\MetaFoxConstant::SORT_DESC], \MetaFox\Platform\Support\Browse\Browse::SORT_MOST_DISCUSSED => ['feed.total_comment' => null, 'stream.updated_at' => \MetaFox\Platform\MetaFoxConstant::SORT_DESC, 'stream.feed_id' => \MetaFox\Platform\MetaFoxConstant::SORT_DESC], \MetaFox\Platform\Support\Browse\Browse::SORT_MOST_VIEWED => ['feed.total_view' => null, 'stream.updated_at' => \MetaFox\Platform\MetaFoxConstant::SORT_DESC, 'stream.feed_id' => \MetaFox\Platform\MetaFoxConstant::SORT_DESC], \MetaFox\Platform\Support\Browse\Browse::SORT_MOST_LIKED => ['feed.total_like' => null, 'stream.updated_at' => \MetaFox\Platform\MetaFoxConstant::SORT_DESC, 'stream.feed_id' => \MetaFox\Platform\MetaFoxConstant::SORT_DESC], // @todo: TBD for sorting rule \MetaFox\Platform\Support\Browse\Browse::SORT_TOP_STORIES => ['stream.updated_at' => \MetaFox\Platform\MetaFoxConstant::SORT_DESC, 'feed.total_comment' => null, 'feed.total_like' => null, 'stream.feed_id' => \MetaFox\Platform\MetaFoxConstant::SORT_DESC], ]

$select

public array<string|int, string> $select = [ // 'stream.id', 'stream.feed_id', 'stream.updated_at', ]

$sortMapping

public array<string, string> $sortMapping = ['stream.feed_id' => 'id', 'stream.updated_at' => 'updated_at', 'feed.total_like' => 'total_like', 'feed.total_comment' => 'total_comment', 'feed.total_view' => 'total_view', 'stream.created_at' => 'created_at']

$isGreaterThanLastFeed

protected bool $isGreaterThanLastFeed = false

$isViewSearchString

protected bool $isViewSearchString = false

$additionalConditions

private array<string, mixed> $additionalConditions = null

| array<int, mixed> |null

$eagerLoads

private array<string|int, string> $eagerLoads = []

$limit

private int $limit = \MetaFox\Platform\Support\Helper\Pagination::DEFAULT_ITEM_PER_PAGE

$loadedSponsoredFeedIds

private array<string|int, mixed>|null $loadedSponsoredFeedIds = null

$pinnedFeedIds

private array<string|int, mixed> $pinnedFeedIds = []

$sponsoredFeedIds

private array<string|int, mixed> $sponsoredFeedIds = []

$status

private array<string|int, mixed>|null $status = null

Methods

addPinnedFeedIds()

public addPinnedFeedIds(Collection $collection) : mixed
Parameters
$collection : Collection

addSponsoredFeed()

public addSponsoredFeed(Collection $collection) : void
Parameters
$collection : Collection

fetchPinnedFeeds()

Fetch pinned feed into a collections when prepend to collection, we need to keep ordering of lasted pined at first.

public fetchPinnedFeeds() : void

So we need to sort out ordering in a right way, then collection just keep ordering only.

fetchSponsoredFeeds()

public fetchSponsoredFeeds([array<string|int, mixed>|null $loadedSponsoredFeedIds = null ]) : array<string|int, mixed>
Parameters
$loadedSponsoredFeedIds : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>

fetchStream()

public fetchStream([int|null $lastFeedId = null ][, string|null $timeFrom = null ][, string|null $timeTo = null ]) : Collection
Parameters
$lastFeedId : int|null = null
$timeFrom : string|null = null
$timeTo : string|null = null
Return values
Collection

fetchStreamContinuous()

public fetchStreamContinuous(Collection $result, int $need, int|null $lastFeedId, int $try) : void
Parameters
$result : Collection
$need : int
$lastFeedId : int|null
$try : int
Tags
SuppressWarnings

(PHPMD.ElseExpression)

SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

getEagerLoads()

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

getFeedSortView()

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

getHomepageLimit()

public getHomepageLimit() : int
Return values
int

getIsGreaterThanLastFeed()

public getIsGreaterThanLastFeed() : bool
Return values
bool

getOwnerId()

public getOwnerId() : int|null
Return values
int|null

getPinnedFeedIds()

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

getProfileLimit()

public getProfileLimit() : int
Return values
int

getSelect()

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

getSortFields()

public getSortFields() : array<string, mixed>
Return values
array<string, mixed>

getSortType()

public getSortType() : string
Return values
string

getSortView()

public getSortView() : string
Return values
string

getSponsoredFeedLimit()

public getSponsoredFeedLimit() : int
Return values
int

getStatus()

public getStatus() : string
Return values
string

getUserId()

public getUserId() : int|null
Return values
int|null

hasAdditionalConditions()

public hasAdditionalConditions() : bool
Return values
bool

isOnlyFriends()

public isOnlyFriends() : bool
Return values
bool

isPreviewTag()

public isPreviewTag() : int
Return values
int

isSearchByStreamId()

public isSearchByStreamId() : bool
Return values
bool

isViewHashtag()

public isViewHashtag() : bool
Return values
bool

isViewOnProfile()

public isViewOnProfile() : bool
Return values
bool

isViewSearch()

public isViewSearch() : bool
Return values
bool

setAdditionalConditions()

public setAdditionalConditions(array<string|int, mixed> $additionalConditions) : StreamManager
Parameters
$additionalConditions : array<string|int, mixed>
Return values
StreamManager

setIsGreaterThanLastFeed()

public setIsGreaterThanLastFeed([bool $value = true ]) : $this
Parameters
$value : bool = true
Return values
$this

setIsViewSearch()

public setIsViewSearch(bool $isViewSearch) : $this
Parameters
$isViewSearch : bool
Return values
$this

setLimit()

public setLimit(int $limit) : self
Parameters
$limit : int
Return values
self

setLoadedSponsoredFeedIds()

public setLoadedSponsoredFeedIds(array<string|int, mixed>|null $ids) : $this
Parameters
$ids : array<string|int, mixed>|null
Return values
$this

setOnlyFriends()

public setOnlyFriends(bool $onlyFriends) : $this
Parameters
$onlyFriends : bool
Return values
$this

setOwnerId()

public setOwnerId(int $ownerId) : self
Parameters
$ownerId : int
Return values
self

setPreviewTag()

public setPreviewTag(bool $isPreviewTag) : $this
Parameters
$isPreviewTag : bool
Return values
$this

setSearchString()

public setSearchString(string $search) : $this
Parameters
$search : string
Return values
$this

setSelect()

public setSelect(array<string|int, string> $select) : self
Parameters
$select : array<string|int, string>
Return values
self

setSortFields()

public setSortFields(string $view[, string $sortType = MetaFoxConstant::SORT_DESC ]) : self
Parameters
$view : string
$sortType : string = MetaFoxConstant::SORT_DESC
Return values
self

setUserId()

public setUserId(int $userId) : self
Parameters
$userId : int
Return values
self

toFeeds()

Convert from get stream (feed ids) to collection of Feeds.

public toFeeds(array<string|int, int> $feedIds) : Collection
Parameters
$feedIds : array<string|int, int>
Return values
Collection

buildProfileQueryForMember()

protected buildProfileQueryForMember(bool|null $isFriendOfFriend) : Builder
Parameters
$isFriendOfFriend : bool|null
Return values
Builder

buildProfileQueryForModeration()

protected buildProfileQueryForModeration() : Builder
Return values
Builder

buildQuery()

protected buildQuery([int|null $lastFeedId = null ][, string|null $timeFrom = null ][, string|null $timeTo = null ]) : Builder|null
Parameters
$lastFeedId : int|null = null
$timeFrom : string|null = null
$timeTo : string|null = null
Tags
SuppressWarnings

(PHPMD.ElseExpression)

SuppressWarnings

(PHPMD.CyclomaticComplexity)

Return values
Builder|null

buildQueryForFriendsOnly()

protected buildQueryForFriendsOnly(Builder $query) : void
Parameters
$query : Builder

queryHomeFeed()

protected queryHomeFeed() : Builder
Return values
Builder

queryProfileFeed()

protected queryProfileFeed() : Builder
Return values
Builder

handleAdditionalConditions()

private handleAdditionalConditions(Builder $query, array<string|int, mixed> $conditions) : Builder
Parameters
$query : Builder
$conditions : array<string|int, mixed>
Return values
Builder

        
On this page

Search results