MetaFox

JsonImporterForCategory extends JsonImporter
in package

Table of Contents

Properties

$fillable  : array<string|int, string>
$batchedData  : array<string|int, mixed>
$bundle  : mixed
$entries  : array<string|int, mixed>
$keepOldId  : bool
$landingPageMapping  : array<string|int, mixed>
$mentionUsers  : array<string|int, mixed>
$privacyMapping  : array<string|int, mixed>
$requiredColumns  : array<string|int, mixed>
$source  : string
$uniqueColumns  : array<string|int, mixed>

Methods

afterImport()  : void
afterPrepare()  : void
appendFileBundle()  : void
appendPhotoBundle()  : void
array_unique_values()  : array<string|int, mixed>
beforeImport()  : void
beforePrepare()  : void
debug()  : void
error()  : void
exportBundled()  : void
exportBundledEntries()  : void
fillIdFromEntries()  : void
call this method before run import().
getEntryRepository()  : EntryRepositoryInterface
getModelClass()  : string
example: MetaFox\Blog\Models\Blog::class.
getPrivacyList()  : array<string|int, mixed>
getRequiredColumns()  : array<string|int, mixed>
handleEmoji()  : string
importTagData()  : void
info()  : void
insertBatchEntriesInChunked()  : mixed
insertEntries()  : void
loadExistsIdFromImporterEntries()  : mixed
nextIdForResource()  : int
parseMention()  : string
parseText()  : string
privacyMap()  : mixed
privacyMapEntry()  : string
processImport()  : mixed
processImportEntries()  : void
processImportEntry()  : void
processImportUserMention()  : void
processPrepare()  : void
processPrivacyStream()  : mixed
remapEmoji()  : void
remapLandingPage()  : void
remapRefs()  : void
setup()  : void
transformActivitySubscription()  : mixed
transformPrivacyList()  : void
transformPrivacyMember()  : void
transformUserPrivacy()  : void
upsertBatchEntriesInChunked()  : mixed
validateEntry()  : bool
validateRequiredColumns()  : bool
warning()  : void
_loadMissingIds()  : mixed
addEntryToBatch()  : void
Add item to batch.
getBatchEntries()  : array<string|int, mixed>
getChunkEntries()  : mixed
getRegexPattern()  : string
getUniqueColumns()  : array<string|int, mixed>
get unique string id.
loadExistsIdFromUniqueColumns()  : void
loadMissingBigNumberIds()  : mixed
loadPreservedIds()  : mixed
nextSequenceBigNumberIdForResource()  : mixed
get next Id
pickEntriesValue()  : array<string|int, mixed>
Got string[] of ref column.
pluckRefMap()  : array<string|int, mixed>
Got string[] of ref column.
remapCurrency()  : void
remapRelation()  : void
statChunkEntries()  : mixed
remapRef()  : array<string|int, mixed>

Properties

$batchedData

protected array<string|int, mixed> $batchedData = []

$entries

protected array<string|int, mixed> $entries = []

$landingPageMapping

protected array<string|int, mixed> $landingPageMapping = ['phpfox' => ['blog' => 'blog', 'event' => 'event', 'forum' => 'forum', 'marketplace' => 'marketplace', 'photo' => 'photo', 'poll' => 'poll', 'quiz' => 'quiz', 'v' => 'video', 'home' => 'home', 'info' => 'about', 'members' => 'member']]

$mentionUsers

protected array<string|int, mixed> $mentionUsers = []

$privacyMapping

protected array<string|int, mixed> $privacyMapping = ['phpfox' => ['0' => \MetaFox\Platform\MetaFoxPrivacy::EVERYONE, '1' => \MetaFox\Platform\MetaFoxPrivacy::FRIENDS, '2' => \MetaFox\Platform\MetaFoxPrivacy::FRIENDS_OF_FRIENDS, '3' => \MetaFox\Platform\MetaFoxPrivacy::ONLY_ME, '4' => \MetaFox\Platform\MetaFoxPrivacy::CUSTOM, '6' => \MetaFox\Platform\MetaFoxPrivacy::MEMBERS]]

$requiredColumns

protected array<string|int, mixed> $requiredColumns = []

$uniqueColumns

protected array<string|int, mixed> $uniqueColumns = []

Methods

appendFileBundle()

public appendFileBundle(string $column[, int $priority = 2 ]) : void
Parameters
$column : string
$priority : int = 2

appendPhotoBundle()

public appendPhotoBundle(string $column[, int $priority = 3 ][, string $relatedType = null ][, string $relatedClass = null ][, string $owner = '$owner' ]) : void
Parameters
$column : string
$priority : int = 3
$relatedType : string = null
$relatedClass : string = null
$owner : string = '$owner'

array_unique_values()

public array_unique_values(array<string|int, mixed> $array, array<string|int, mixed> $uniqueColumns) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
$uniqueColumns : array<string|int, mixed>
Return values
array<string|int, mixed>

debug()

public debug(string $message[, array<string|int, mixed> $extras = [] ]) : void
Parameters
$message : string
$extras : array<string|int, mixed> = []

error()

public error(string $message[, array<string|int, mixed> $extras = [] ]) : void
Parameters
$message : string
$extras : array<string|int, mixed> = []

exportBundled()

public exportBundled(string $resource, int $priority, string|null $column, Closure $callback) : void
Parameters
$resource : string
$priority : int
$column : string|null
$callback : Closure

exportBundledEntries()

public exportBundledEntries(array<string|int, mixed> &$data, string $resource[, int $priority = 0 ][, string $suffix = '' ]) : void
Parameters
$data : array<string|int, mixed>
$resource : string
$priority : int = 0
$suffix : string = ''

fillIdFromEntries()

call this method before run import().

public fillIdFromEntries() : void

getEntryRepository()

public getEntryRepository() : EntryRepositoryInterface
Return values
EntryRepositoryInterface

getModelClass()

example: MetaFox\Blog\Models\Blog::class.

public getModelClass() : string
Return values
string

getPrivacyList()

public getPrivacyList(mixed $entry) : array<string|int, mixed>
Parameters
$entry : mixed
Return values
array<string|int, mixed>

getRequiredColumns()

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

handleEmoji()

public handleEmoji(array<string|int, mixed> $list, string $pattern, string $text) : string
Parameters
$list : array<string|int, mixed>
$pattern : string
$text : string
Return values
string

importTagData()

public importTagData(string $model) : void
Parameters
$model : string

info()

public info(string $message[, array<string|int, mixed> $extras = [] ]) : void
Parameters
$message : string
$extras : array<string|int, mixed> = []

insertBatchEntriesInChunked()

public insertBatchEntriesInChunked(string $modelClass[, int $limit = 100 ]) : mixed
Parameters
$modelClass : string
$limit : int = 100

loadExistsIdFromImporterEntries()

public loadExistsIdFromImporterEntries() : mixed

nextIdForResource()

public nextIdForResource(string $resourceName[, int $amount = 1 ]) : int
Parameters
$resourceName : string
$amount : int = 1
Return values
int

parseMention()

public parseMention(string $text[, array<string|int, mixed> $entry = [] ]) : string
Parameters
$text : string
$entry : array<string|int, mixed> = []
Return values
string

parseText()

public parseText(string $text[, bool $isHtmlContent = true ][, bool $parseMention = false ][, array<string|int, mixed>|null $entry = [] ]) : string
Parameters
$text : string
$isHtmlContent : bool = true
$parseMention : bool = false
$entry : array<string|int, mixed>|null = []
Return values
string

privacyMap()

public privacyMap(int|string $privacy) : mixed
Parameters
$privacy : int|string

privacyMapEntry()

public privacyMapEntry(array<string|int, mixed> $entry[, string $privacyColumn = 'privacy' ][, string $privacyListColumn = 'privacy_list' ]) : string
Parameters
$entry : array<string|int, mixed>
$privacyColumn : string = 'privacy'
$privacyListColumn : string = 'privacy_list'
Return values
string

processImportEntries()

public processImportEntries() : void

processImportEntry()

public processImportEntry(array<string|int, mixed> &$entry) : void
Parameters
$entry : array<string|int, mixed>

processImportUserMention()

public processImportUserMention() : void

processPrivacyStream()

public processPrivacyStream(string $modelClass[, string $privacyColumn = 'privacy' ][, string $privacyListColumn = 'privacy_list' ][, string $ownerIdColumn = '$owner' ]) : mixed
Parameters
$modelClass : string
$privacyColumn : string = 'privacy'
$privacyListColumn : string = 'privacy_list'
$ownerIdColumn : string = '$owner'

remapEmoji()

public remapEmoji([string|array<string|int, mixed> $fields = ['text', 'text_parsed'] ][, bool $isTwaEmoji = false ]) : void
Parameters
$fields : string|array<string|int, mixed> = ['text', 'text_parsed']
$isTwaEmoji : bool = false

remapRefs()

public remapRefs(array<string|int, mixed> $map) : void
Parameters
$map : array<string|int, mixed>

setup()

public setup(array<string|int, mixed> $entries, mixed $bundle) : void
Parameters
$entries : array<string|int, mixed>
$bundle : mixed

transformActivitySubscription()

public transformActivitySubscription([mixed $userCol = '$user' ][, mixed $ownerCol = '$owner' ][, mixed $subSuperAdmin = false ]) : mixed
Parameters
$userCol : mixed = '$user'
$ownerCol : mixed = '$owner'
$subSuperAdmin : mixed = false

transformPrivacyList()

public transformPrivacyList(mixed $privacy, string $privacyType[, string $userCol = '$user' ][, string $ownerCol = '$owner' ][, string $suffixId = '' ]) : void
Parameters
$privacy : mixed
$privacyType : string
$userCol : string = '$user'
$ownerCol : string = '$owner'
$suffixId : string = ''

transformPrivacyMember()

public transformPrivacyMember([array<string|int, mixed> $privacyList = [] ][, string $privacyBy = '$user' ][, string $ownerCol = null ][, string $modelClass = PrivacyMember::class ]) : void
Parameters
$privacyList : array<string|int, mixed> = []
$privacyBy : string = '$user'
$ownerCol : string = null
$modelClass : string = PrivacyMember::class

transformUserPrivacy()

public transformUserPrivacy() : void

upsertBatchEntriesInChunked()

public upsertBatchEntriesInChunked(string $modelClass, array<string|int, mixed> $uniqueKeys[, int $limit = 100 ]) : mixed
Parameters
$modelClass : string
$uniqueKeys : array<string|int, mixed>
$limit : int = 100

validateEntry()

public validateEntry(array<string|int, mixed> &$entry) : bool
Parameters
$entry : array<string|int, mixed>
Return values
bool

validateRequiredColumns()

public validateRequiredColumns(array<string|int, mixed> &$entry) : bool
Parameters
$entry : array<string|int, mixed>
Return values
bool

warning()

public warning(string $message[, array<string|int, mixed> $extras = [] ]) : void
Parameters
$message : string
$extras : array<string|int, mixed> = []

_loadMissingIds()

protected _loadMissingIds(string $resource, string $column) : mixed
Parameters
$resource : string
$column : string

addEntryToBatch()

Add item to batch.

protected addEntryToBatch(string $modelClass, array<string|int, mixed> $item) : void
Parameters
$modelClass : string
$item : array<string|int, mixed>

getBatchEntries()

protected getBatchEntries(mixed $resource) : array<string|int, mixed>
Parameters
$resource : mixed
Return values
array<string|int, mixed>

getChunkEntries()

protected getChunkEntries(string $resource, int $length) : mixed
Parameters
$resource : string
$length : int

getRegexPattern()

protected getRegexPattern(array<string|int, mixed> $list) : string
Parameters
$list : array<string|int, mixed>
Return values
string

getUniqueColumns()

get unique string id.

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

loadExistsIdFromUniqueColumns()

protected loadExistsIdFromUniqueColumns() : void

loadMissingBigNumberIds()

protected loadMissingBigNumberIds() : mixed

loadPreservedIds()

protected loadPreservedIds() : mixed

nextSequenceBigNumberIdForResource()

get next Id

protected nextSequenceBigNumberIdForResource(string $resource) : mixed
Parameters
$resource : string

pickEntriesValue()

Got string[] of ref column.

protected pickEntriesValue(string $column) : array<string|int, mixed>
Parameters
$column : string
Tags
code

$importer->pluckRefOf($entries, '$id')

endcode
Return values
array<string|int, mixed>

pluckRefMap()

Got string[] of ref column.

protected pluckRefMap(string $column) : array<string|int, mixed>
Parameters
$column : string
Tags
code

$importer->pluckRefMap($entries, '$id')

endcode
Return values
array<string|int, mixed>

remapRelation()

protected remapRelation(string $refColumn, string $toColumn, string $modelClass, string $fromColumn[, mixed|null $default = null ]) : void
Parameters
$refColumn : string
$toColumn : string
$modelClass : string
$fromColumn : string
$default : mixed|null = null
Tags
code

$this->remapRelation(Currency:class, '$currency','code', 'currency_code')

endcode

statChunkEntries()

protected statChunkEntries(string $resource) : mixed
Parameters
$resource : string

remapRef()

private remapRef(string $refColumn, string|null $idColunn, string|null $typeColumn) : array<string|int, mixed>
Parameters
$refColumn : string
$idColunn : string|null
$typeColumn : string|null
Return values
array<string|int, mixed>

        
On this page

Search results