Class ApiHook
Handles External API subscriptions (for pushing data).
This model record is for managing "subscriptions" to events in X2Engine. The purpose behind this all is to allow a means to enact changes to other systems in response to events in X2Engine without the need for polling.
Each time X2Flow::trigger()
is called, all hooks matching the name of
the triggering event will also be called. Then, POST requests will be sent to
the URL specified by the "target_url" attribute, and the payload will be either
arbitrary data, or a URL within the REST API at which to retrieve the payload
(if the payload is an instance of X2Model
). Each record of this model
type is thus in effect a request to either send data to a remote service, or
notify that remote service that it needs to fetch data from X2Engine at a given
resource location.
- CComponent
- CModel implements IteratorAggregate, ArrayAccess
- CActiveRecord
- ApiHook
Author: Demitri Morgan <demitri@x2engine.com>
Located at x2engine/protected/models/ApiHook.php
public
array
|
#
attributeLabels( )
Returns the attribute labels. Attribute labels are mainly used in error
messages of validation. By default an attribute label is generated using |
public
boolean
|
|
public static
array
|
|
public
type
|
#
getMaxNHooks( )
Getter w/stripped code (Platinum-only settings) for the maximum number of API hooks to send. |
public
|
|
public
|
|
public
boolean
|
#
insert( array $attributes = null )
Inserts a row into the table based on this active record attributes. If the
table's primary key is auto-incremental and is null before insertion, it will be
populated with the actual value after insertion. Note, validation is not
performed in this method. You may call |
public
|
#
maxBatchSize( type $attribute, type $params = array() )
Validator for limiting the number of hooks on a given action. |
public static
static
|
|
public
array
|
|
public
|
|
public static
|
|
public
|
|
public
string
|
__call(),
__construct(),
__get(),
__isset(),
__set(),
__sleep(),
__unset(),
addRelatedRecord(),
afterDelete(),
afterFind(),
afterFindInternal(),
afterSave(),
applyScopes(),
attributeNames(),
beforeCount(),
beforeFind(),
beforeFindInternal(),
beforeSave(),
cache(),
count(),
countByAttributes(),
countBySql(),
defaultScope(),
delete(),
deleteAll(),
deleteAllByAttributes(),
deleteByPk(),
equals(),
exists(),
find(),
findAll(),
findAllByAttributes(),
findAllByPk(),
findAllBySql(),
findByAttributes(),
findByPk(),
findBySql(),
getActiveFinder(),
getActiveRelation(),
getAttribute(),
getAttributeLabel(),
getAttributes(),
getCommandBuilder(),
getDbConnection(),
getDbCriteria(),
getIsNewRecord(),
getMetaData(),
getOldPrimaryKey(),
getPrimaryKey(),
getRelated(),
getTableAlias(),
getTableSchema(),
hasAttribute(),
hasRelated(),
init(),
instantiate(),
offsetExists(),
onAfterDelete(),
onAfterFind(),
onAfterSave(),
onBeforeCount(),
onBeforeDelete(),
onBeforeFind(),
onBeforeSave(),
populateRecord(),
populateRecords(),
primaryKey(),
query(),
refresh(),
refreshMetaData(),
relations(),
resetScope(),
save(),
saveAttributes(),
saveCounters(),
scopes(),
setAttribute(),
setDbCriteria(),
setIsNewRecord(),
setOldPrimaryKey(),
setPrimaryKey(),
setTableAlias(),
together(),
update(),
updateAll(),
updateByPk(),
updateCounters(),
with()
|
addError(),
addErrors(),
afterConstruct(),
afterValidate(),
beforeValidate(),
behaviors(),
clearErrors(),
createValidators(),
generateAttributeLabel(),
getError(),
getErrors(),
getIterator(),
getSafeAttributeNames(),
getScenario(),
getValidatorList(),
getValidators(),
hasErrors(),
isAttributeRequired(),
isAttributeSafe(),
offsetGet(),
offsetSet(),
offsetUnset(),
onAfterConstruct(),
onAfterValidate(),
onBeforeValidate(),
onUnsafeAttribute(),
setAttributes(),
setScenario(),
unsetAttributes(),
validate()
|
asa(),
attachBehavior(),
attachBehaviors(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
detachBehavior(),
detachBehaviors(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
getEventHandlers(),
hasEvent(),
hasEventHandler(),
hasProperty(),
raiseEvent()
|
integer |
MAX_API_HOOK_BATCH
|
3 |
#
No more than this number of remote hooks can run at a time. |
integer |
MAX_WAIT_TIME
|
3 |
#
Hook timeout after 3 seconds |
BELONGS_TO,
HAS_MANY,
HAS_ONE,
MANY_MANY,
STAT
|
public
mixed
|
$sent | false |
#
Response data, or false if no requests have yet been sent. |
$db
|
$attributes,
$commandBuilder,
$dbConnection,
$dbCriteria,
$isNewRecord,
$metaData,
$oldPrimaryKey,
$primaryKey,
$tableAlias,
$tableSchema
|
$errors,
$iterator,
$safeAttributeNames,
$scenario,
$validatorList,
$validators
|