JsonImporterForCategoryData
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
$fillable
public
array<string|int, string>
$fillable
$batchedData
protected
array<string|int, mixed>
$batchedData
= []
$bundle
protected
mixed
$bundle
$entries
protected
array<string|int, mixed>
$entries
= []
$keepOldId
protected
bool
$keepOldId
= false
$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
= ['item_id', 'category_id']
$source
protected
string
$source
$uniqueColumns
protected
array<string|int, mixed>
$uniqueColumns
= []
Methods
afterImport()
public
afterImport() : void
afterPrepare()
public
afterPrepare() : void
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>beforeImport()
public
beforeImport() : void
beforePrepare()
public
beforePrepare() : void
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
EntryRepositoryInterfacegetModelClass()
example: MetaFox\Blog\Models\Blog::class.
public
getModelClass() : string
Return values
stringgetPrivacyList()
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
stringimportTagData()
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
insertEntries()
public
insertEntries() : void
loadExistsIdFromImporterEntries()
public
loadExistsIdFromImporterEntries() : mixed
nextIdForResource()
public
nextIdForResource(string $resourceName[, int $amount = 1 ]) : int
Parameters
- $resourceName : string
- $amount : int = 1
Return values
intparseMention()
public
parseMention(string $text[, array<string|int, mixed> $entry = [] ]) : string
Parameters
- $text : string
- $entry : array<string|int, mixed> = []
Return values
stringparseText()
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
stringprivacyMap()
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
stringprocessImport()
public
processImport() : mixed
processImportEntries()
public
processImportEntries() : void
processImportEntry()
public
processImportEntry(array<string|int, mixed> &$entry) : void
Parameters
- $entry : array<string|int, mixed>
processImportUserMention()
public
processImportUserMention() : void
processPrepare()
public
processPrepare() : 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
remapLandingPage()
public
remapLandingPage() : void
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
boolvalidateRequiredColumns()
public
validateRequiredColumns(array<string|int, mixed> &$entry) : bool
Parameters
- $entry : array<string|int, mixed>
Return values
boolwarning()
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
stringgetUniqueColumns()
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
Return values
array<string|int, mixed>pluckRefMap()
Got string[] of ref column.
protected
pluckRefMap(string $column) : array<string|int, mixed>
Parameters
- $column : string
Tags
Return values
array<string|int, mixed>remapCurrency()
protected
remapCurrency() : void
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
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