TableMock
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- addColumn() : mixed
- addValue() : void
- values: ['value1', 'value2', 'value3', ...]
- addValueMap() : void
- columnValueMap: [ 'col1' => 'value1', 'col3' => 'value3', 'col6' => value6 ];
- delete() : void
- getData() : array<string|int, mixed>
- isCreated() : bool
- update() : void
- Update rows in the table that match the where condition
- getColumnNames() : array<string|int, mixed>
Properties
$dir
private
string
$dir
= __DIR__
$name
private
string
$name
$pdo
private
PDO
$pdo
Methods
__construct()
public
__construct(PDO $pdo, string $name, bool $use_sql_file, string|null $pk_name) : mixed
Parameters
- $pdo : PDO
- $name : string
- $use_sql_file : bool
- $pk_name : string|null
addColumn()
public
addColumn(mixed $col_name, mixed $col_type) : mixed
Parameters
- $col_name : mixed
- $col_type : mixed
addValue()
values: ['value1', 'value2', 'value3', ...]
public
addValue(mixed ...$values) : void
All columns must be set here. To set only one column, use the 'addValueMap' function
Parameters
- $values : mixed
addValueMap()
columnValueMap: [ 'col1' => 'value1', 'col3' => 'value3', 'col6' => value6 ];
public
addValueMap(array<string|int, mixed> $columnValueMap) : void
Parameters
- $columnValueMap : array<string|int, mixed>
delete()
public
delete(string $where) : void
Parameters
- $where : string
getData()
public
getData([mixed $where = null ]) : array<string|int, mixed>
Parameters
- $where : mixed = null
Return values
array<string|int, mixed>isCreated()
public
isCreated() : bool
Return values
boolupdate()
Update rows in the table that match the where condition
public
update(array<string|int, mixed> $values, string $where) : void
Parameters
- $values : array<string|int, mixed>
-
Map of column names to new values
- $where : string
-
SQL WHERE clause
getColumnNames()
private
getColumnNames() : array<string|int, mixed>