HttpTestSource
package |
HttpSourceTest |
---|---|
subpackage |
Model.Datasource |
__construct(array $config = array(), \HttpSourceConnection $Connection = null)
_addTransaction(string $method, array $request) : boolean
string
array
boolean
_buildRequest(string $method, \Model $model, array $queryData = array(), array $fields = null, array $values = null, array $conditions = null, integer $recursive = null)
throws | |
---|---|
string
create/read/update/delete
\Model
The model being read.
array
Query data for read
array
Fields for save/create
array
Fields values for update/create
array
Conditions for update
integer
Number of levels of association. NOT USED YET
_emulateFields(\Model $Model, array &$result)
\Model
array
_emulateFunctions(\Model $Model, array &$result) : boolean
\Model
array
boolean
True if function applied
_emulateLimit(\Model $Model, array &$result)
\Model
array
_emulateOrder(\Model $Model, array &$result)
\Model
array
_extractResult(\Model $model, array $result, string $requestMethod, boolean $force = false) : array
\Model
array
string
boolean
array
_formatResult(\Model $Model, array &$result)
\Model
array
_getCurrentEndpoint() : \HttpSourceEndpoint
_getQueryData(string $path = null) : mixed
string
mixed
_joinResponses(array $responses) : array
array
array
_loadConfig(string $plugin)
string
_requestToModel(array $request, \Model $Model = null) : \AppModel
array
\Model
\AppModel
_schemaToRequests(\CakeSchema $Schema, string $tableName, array $options) : array
\CakeSchema
string
array
array
_scrubQueryData(array $data) : array
array
array
_setConfig(\HttpSourceConfig $Config)
_singleRequest(array $request, string $requestMethod, \Model $model = null) : array|boolean
array
string
\Model
array|boolean
_splitRequest(array $request) : array
array
array
_writeQueryCache(array $request, mixed $data)
array
Http request
mixed
result of $request query
afterRequest(\Model $model, array $result, string $requestMethod) : array
Override this method for your DataSource.
\Model
array
string
Create, update, read or delete
array
beforeRequest(array $request, string $requestMethod) : array
array
string
Create, update, read or delete
array
$request
begin() : boolean
boolean
Returns true if a transaction is not in progress
calculate(\Model $model, string $func, array $params = array()) : string
throws |
---|
\Model
string
Lowercase name of function, i.e. 'count'
array
Function parameters (any values must be quoted manually)
string
An calculation function
commit() : boolean
boolean
Returns true if a transaction is in progress
create(\Model $model, array $fields = null, array $values = null)
\Model
array
Unused
array
Unused
createSchema(\CakeSchema $Schema, string $tableName = null) : array
\CakeSchema
string
array
delete(\Model $model, array $conditions = null)
\Model
array
describe(\Model $model) : array
\Model
array
dropSchema(\CakeSchema $Schema, string $tableName = null) : array
\CakeSchema
string
array
execute(array $request) : array
array
array
exists(\Model $model, array $conditions = array())
\Model
array
getCredentials() : array
array
getDecoder(string $contentType)
string
Content type
getLog(boolean $sorted = false, boolean $clear = true) : array
boolean
Get the queries sorted by time taken, defaults to false.
boolean
If True the existing log will cleared.
array
Array of queries run as an array
getMethods() : array
array
getQueryCache(array $request) : mixed
array
query
mixed
results for query if it is cached, false otherwise
getRequestLog() : array
array
getTransactionParams() : array
array
listSources(mixed $data = null) : array
mixed
array
Array of sources available in this datasource.
logRequest() : void
query(mixed $request) : array|false
throws |
---|
mixed
Array of request or string uri
array|false
queryAssociation(\Model $model, \Model &$linkModel, string $type, string $association, array $assocData, array &$queryData, boolean $external, array &$resultSet, integer $recursive, array $stack) : mixed
throws |
---|
\Model
Primary Model object
\Model
Linked model that
string
Association type, one of the model association types ie. hasMany
string
array
array
boolean
Whether or not the association query is on an external datasource.
array
Existing results
integer
Number of levels of association
array
mixed
read(string $model, string $queryData = array(), integer $recursive = null) : mixed
access |
public |
---|
string
The model being read.
string
An array of query data used to find the data you want
integer
mixed
request(\Model $model = null, mixed $requestData = null, string $requestMethod = \HttpSource::METHOD_READ) : array|false
throws |
---|
\Model
Model object
mixed
Array of request or string uri
string
read, create, update, delete
array|false
$response
rollback() : boolean
boolean
Returns true if a transaction is in progress
setCredentials(array $credentials = array())
array
setDecoder(string|array $contentType, callable $callback, boolean $replace = false)
string|array
Content type
callable
Function used for decoding
boolean
Replace decoder if already set or not. Default false
setTransactionParams(string $table, array $params, string $transactionsField, string $method)
string
array
string
string
showLog(boolean $sorted = false, boolean $html = null) : void
boolean
Get the queries sorted by time taken, defaults to false.
boolean
True for html output, null for auto
swapTokens(array &$request)
array
update(\Model $model, array $fields = null, array $values = null, array $conditions = null)
\Model
array
array
array
FUNCTION_COUNT
METHOD_READ
METHOD_CREATE
METHOD_UPDATE
METHOD_DELETE
METHOD_CHECK
HTTP_METHOD_READ
HTTP_METHOD_CREATE
HTTP_METHOD_UPDATE
HTTP_METHOD_DELETE
HTTP_METHOD_CHECK
LOG_MAX_LENGTH
LOG_TRUNCATED
_requestsLogMax : integer
This is to prevent query log taking over too much memory.
var |
Maximum number of queries in the queries log. |
---|
integer
description : string
var |
---|
string
fullDebug : boolean
var |
---|
boolean
config : array
var |
---|
array
took : integer
var |
---|
integer
query : string
var |
---|
string
affected : integer
var |
---|
integer
numRows : integer
var |
---|
integer
error : string
var |
---|
string
columns : array
Used in Model::save, Model::create methods
var |
---|
array
_Connection : \HttpSourceConnection
_currentEndpoint : \HttpSourceEndpoint
_requestsCnt : integer
var |
---|
integer
_requestsTime : integer
var |
---|
integer
_requestsLog : array
var |
---|
array
_requestCache : array
var |
Cache of results from executed queries. |
---|
array
_queryData : array
var |
---|
array
_transactionParams : array
var |
---|
array
_transactions : array
var |
---|
array