Documentation

CustomFieldsModel
in package
Uses ApropriateConnectionTrait

Model for processing custom fields

Tags
author

Dodonov A.A.

Table of Contents

$tableName  : mixed
Table name
__construct()  : mixed
Constructor
customFieldExists()  : bool
Checking if the custom field exists
deleteCustomFieldsForObject()  : void
Deleting custom fields for object
getApropriateConnection()  : PdoCrud
Method returns appropriate connections
getCustomFieldsForObject()  : array<string, string>
Getting custom fields for object
getCustomFieldsForRecords()  : array<string|int, mixed>
Method fetches custom fields for record
getFieldForObject()  : string
Method sets custom field for object
setFieldForObject()  : void
Method sets custom field
updateCustomFieldWithoutValidations()  : void
Method updates custom field without any validations
getCustomFieldsTemplateName()  : string
Method returns table name

Properties

Methods

__construct()

Constructor

public __construct(string $tableName) : mixed
Parameters
$tableName : string

name of the table

Return values
mixed

customFieldExists()

Checking if the custom field exists

public customFieldExists(int $objectId, string $fieldName) : bool
Parameters
$objectId : int

object's id

$fieldName : string

field name

Return values
bool

true if the field exists, false otherwise

deleteCustomFieldsForObject()

Deleting custom fields for object

public deleteCustomFieldsForObject(int $objectId[, array<string|int, string> $filter = [] ]) : void
Parameters
$objectId : int

object id

$filter : array<string|int, string> = []

list of required fields

Return values
void

getCustomFieldsForObject()

Getting custom fields for object

public getCustomFieldsForObject(int $objectId[, array<string|int, mixed> $filter = ['*'] ]) : array<string, string>
Parameters
$objectId : int

object id

$filter : array<string|int, mixed> = ['*']

list of required fields or all

Tags
psalm-suppress

MixedReturnTypeCoercion, MixedArrayOffset, MixedAssignment

Return values
array<string, string>

result of the fetching

getCustomFieldsForRecords()

Method fetches custom fields for record

public getCustomFieldsForRecords(array<string|int, mixed> $records) : array<string|int, mixed>
Parameters
$records : array<string|int, mixed>

list of records

Return values
array<string|int, mixed>

transformed records

getFieldForObject()

Method sets custom field for object

public getFieldForObject(int $objectId, string $fieldName, string $defaultValue) : string
Parameters
$objectId : int

object's id

$fieldName : string

field's name

$defaultValue : string
Return values
string

field's value

setFieldForObject()

Method sets custom field

public setFieldForObject(int $objectId, string $fieldName, string $fieldValue) : void
Parameters
$objectId : int

object id

$fieldName : string

field name

$fieldValue : string

field value

Return values
void

updateCustomFieldWithoutValidations()

Method updates custom field without any validations

public updateCustomFieldWithoutValidations(int $objectId, string $fieldName, string $fieldValue) : void
Parameters
$objectId : int

object id

$fieldName : string

field name

$fieldValue : string

field value

Return values
void

getCustomFieldsTemplateName()

Method returns table name

private getCustomFieldsTemplateName() : string
Return values
string

Table name

Search results