Api
in package
implements
Controller
Uses
Content, SQL
Generic controller for API.
Each request must json BODY with header:
Authorization: Bearer <token>
Table of Contents
Interfaces
Properties
Methods
- execute() : void
- Execute method dispatcher.
- FSQL() : array<string|int, mixed>
- Flat SQL array result. The order of the field is important.
- FSQL1() : string
- Single value SQL result.
- FSQLC() : array<string|int, mixed>
- Flat SQL array result Column.
- FSQLR() : array<string|int, mixed>
- Flat SQL array result Row.
- SQL() : mixed
- Execute SQL, if select operation return result in associative array.
- SQLBI() : void
- Bulk Insert.
- SQLBU() : void
- Bulk Update, only single pk is allowed.
- SQLR() : array<string|int, mixed>
- Execute SQL, return first row from result.
- authenticate() : array<string|int, mixed>
- Checks for defined authentication classes and attempts to authenticate a token using them.
Properties
$data
Parsed json BODY
protected
mixed
$data
$uid
User ID got from authentication
protected
mixed
$uid
Methods
execute()
Execute method dispatcher.
public
execute(Base $f3[, string $action = "" ]) : void
Parameters
- $f3 : Base
- $action : string = ""
FSQL()
Flat SQL array result. The order of the field is important.
public
FSQL() : array<string|int, mixed>
Return values
array<string|int, mixed>FSQL1()
Single value SQL result.
public
FSQL1() : string
Return values
string —value of the query with 1 row, 1 column (e.g. SELECT COUNT(1))
FSQLC()
Flat SQL array result Column.
public
FSQLC() : array<string|int, mixed>
Return values
array<string|int, mixed>FSQLR()
Flat SQL array result Row.
public
FSQLR() : array<string|int, mixed>
Return values
array<string|int, mixed> —result that only needed only the first record
SQL()
Execute SQL, if select operation return result in associative array.
public
SQL() : mixed
Return values
mixed —result in associative array
SQLBI()
Bulk Insert.
public
SQLBI(string $sql, array<string|int, mixed> $values[, int $chunk_size = 100 ]) : void
Parameters
- $sql : string
- $values : array<string|int, mixed>
- $chunk_size : int = 100
-
(optional)
SQLBU()
Bulk Update, only single pk is allowed.
public
SQLBU(string $sql, string $pk, array<string|int, mixed> $values[, int $chunk_size = 100 ]) : void
Parameters
- $sql : string
- $pk : string
- $values : array<string|int, mixed>
- $chunk_size : int = 100
-
(optional)
SQLR()
Execute SQL, return first row from result.
public
SQLR() : array<string|int, mixed>
Return values
array<string|int, mixed>authenticate()
Checks for defined authentication classes and attempts to authenticate a token using them.
protected
authenticate(string $token) : array<string|int, mixed>
Parameters
- $token : string
Return values
array<string|int, mixed> —an array containing the login information.