Migration
extends Injectable
in package
Manage migrations generation
Table of Contents
- $camelize : Camelize
- Object to camelize texts
- $uncamelize : Uncamelize
- Object to uncamelize texts
- $utils : Utils
- Object to get models utils
- __construct() : mixed
- Generate migration
- checkField() : bool
- Check diffrence betwen 2 fields
- getCurrentVersion() : int
- Get current migration version
- normalize() : array<string|int, mixed>
- Normalize field info from database
- setCurrentVersion() : int|false
- Set a migration version
- getPrefix() : string
- Get table prefix
- isArrayEmpty() : bool
- Check recursivly if there's an empty array
- removeEmptyArray() : void
- Clean data removing empty arrays
Properties
$camelize
Object to camelize texts
private
Camelize
$camelize
$uncamelize
Object to uncamelize texts
private
Uncamelize
$uncamelize
$utils
Object to get models utils
private
Utils
$utils
Methods
__construct()
Generate migration
public
__construct() : mixed
Return values
mixed —checkField()
Check diffrence betwen 2 fields
public
checkField(array<string|int, mixed> $new, array<string|int, mixed> &$old) : bool
Parameters
- $new : array<string|int, mixed>
-
New field
- $old : array<string|int, mixed>
-
Old field
Return values
bool —Result of the check
getCurrentVersion()
Get current migration version
public
static getCurrentVersion() : int
Return values
int —Migration version
normalize()
Normalize field info from database
public
normalize(array<string|int, mixed> $field) : array<string|int, mixed>
Parameters
- $field : array<string|int, mixed>
-
Field data to normalize
Return values
array<string|int, mixed> —Field data normalized
setCurrentVersion()
Set a migration version
public
static setCurrentVersion(int $version) : int|false
Parameters
- $version : int
-
Version to set
Return values
int|false —Result of file_put_contents
getPrefix()
Get table prefix
private
getPrefix(string $table) : string
Parameters
- $table : string
-
Table name
Return values
string —Prefix of the table
isArrayEmpty()
Check recursivly if there's an empty array
private
isArrayEmpty(array<string|int, mixed>|string $data) : bool
Parameters
- $data : array<string|int, mixed>|string
-
Data to check
Return values
bool —Result of the check
removeEmptyArray()
Clean data removing empty arrays
private
removeEmptyArray(array<string|int, mixed> &$data) : void
Parameters
- $data : array<string|int, mixed>
-
data to clean