Synchronize
in package
Allows working and synchronization of records in two separate tables (public and testing)
Tags
Table of Contents
Properties
- $db : SQL
- $fileApi : FileApi
- $orgDir : string|null
- $primary : Form
- $settings : array<string, mixed>
- $syncRec : array<string|int, string|int>
Methods
- __construct() : mixed
- fileCollision() : bool
- Check for possible file collusion between existing(public) and new version
- getPreload() : bool
- getSyncs() : array<string|int, string|int>
- Does record exist in sync table
- isPreload() : bool
- preload() : void
- setPrimary() : void
- Set primary form
- syncFiles() : void
- Update files in public version
- turnDepend() : void
- turnOff() : void
- Disable sync
- turnOn() : void
- Enable sync
- turnView() : void
- Switch table prefix to view
- updateExistence() : void
Properties
$db
protected
SQL
$db
$fileApi
protected
FileApi
$fileApi
$orgDir
protected
string|null
$orgDir
= null
$primary
protected
Form
$primary
$settings
protected
array<string, mixed>
$settings
= []
$syncRec
protected
array<string|int, string|int>
$syncRec
= []
Methods
__construct()
public
__construct(SQL $db, FileApi $fileApi, array<string, mixed> $settings) : mixed
Parameters
fileCollision()
Check for possible file collusion between existing(public) and new version
public
fileCollision(Form $form) : bool
Parameters
- $form : Form
Return values
boolgetPreload()
public
getPreload(string|int $id) : bool
Parameters
- $id : string|int
Return values
boolgetSyncs()
Does record exist in sync table
public
getSyncs(array<string|int, string>|array<string|int, int>|string|int $ids[, bool $sync = true ]) : array<string|int, string|int>
Parameters
- $ids : array<string|int, string>|array<string|int, int>|string|int
- $sync : bool = true
Return values
array<string|int, string|int>isPreload()
public
isPreload() : bool
Return values
boolpreload()
public
preload(array<string|int, string|int>|string|int $ids) : void
Parameters
- $ids : array<string|int, string|int>|string|int
setPrimary()
Set primary form
public
setPrimary(Form $primary) : void
Parameters
- $primary : Form
syncFiles()
Update files in public version
public
syncFiles(array<string, mixed>|null $from, array<string, mixed> $to) : void
Parameters
- $from : array<string, mixed>|null
- $to : array<string, mixed>
turnDepend()
public
turnDepend(int $id[, bool $full = true ]) : void
Parameters
- $id : int
- $full : bool = true
turnOff()
Disable sync
public
turnOff([bool $full = true ]) : void
Parameters
- $full : bool = true
turnOn()
Enable sync
public
turnOn([bool $full = true ]) : void
Parameters
- $full : bool = true
turnView()
Switch table prefix to view
public
turnView() : void
updateExistence()
public
updateExistence(int|null $id, array<string|int, Form> $forms) : void
Parameters
- $id : int|null
- $forms : array<string|int, Form>