Managing Connections
- protected function getConnectionNamespace() — Return a namespace for this object's connections in the connection cache. Generally, the database name is appropriate. Two connections are considered equivalent if they have the same connection namespace and mode.
- protected function getEstablishedConnection($mode) — Get an existing, cached connection for this object.
- protected function setEstablishedConnection($mode, $connection, $force_unique) — Store a connection in the connection cache.
- public function setForcedConnection($connection) — Force an object to use a specific connection.
Configuring Storage
- protected function establishLiveConnection($mode)
- final protected function getConfiguration()
- public function getConfigOption($option_name) — Determine the setting of a configuration option for this class of objects.
- final public function getTableName()
- public static function pushStorageNamespace($namespace)
- public static function popStorageNamespace()
- public static function getDefaultStorageNamespace()
- public static function getStorageNamespace()
- final public function getApplicationName()
Loading Objects
- public function load($id) — Load an object by ID. You need to invoke this as an instance method, not a class method, because PHP doesn't have late static binding (until PHP 5.3.0). For example:
- public function loadAll() — Loads all of the objects, unconditionally.
- public function loadAllWhere($pattern, ...) — Load all objects which match a WHERE clause. You provide everything after the 'WHERE'; Lisk handles everything up to it. For example:
- public function loadOneWhere($pattern, ...) — Load a single object identified by a 'WHERE' clause. You provide everything after the 'WHERE', and Lisk builds the first half of the query. See loadAllWhere(). This method is similar, but returns a single result instead of a list.
- public function reload() — Reload an object from the database, discarding any changes to persistent properties. This is primarily useful after entering a transaction but before applying changes to an object.
- public function loadFromArray($row) — Initialize this object's properties from a dictionary. Generally, you load single objects with loadOneWhere(), but sometimes it may be more convenient to pull data from elsewhere directly (e.g., a complicated join via @{method:queryData}) and then load from an array representation.
- public function loadAllFromArray($rows) — Initialize a list of objects from a list of dictionaries. Usually you load lists of objects with @{method:loadAllWhere}, but sometimes that isn't flexible enough. One case is if you need to do joins to select the right objects:
Application Information
- public function getID() — Retrieve the unique ID identifying this object. This value will be null if the object hasn't been persisted and you didn't set it manually.
- public function hasProperty($property) — Test if a property exists.
- protected function getAllLiskProperties() — Retrieve a list of all object properties. This list only includes properties that are declared as protected, and it is expected that all properties returned by this function should be persisted to the database. Properties that should not be persisted must be declared as private.
- protected function checkProperty($property) — Check if a property exists on this object.
- public function establishConnection($mode, $force_new) — Get or build the database connection for this object.
- protected function getAllLiskPropertyValues() — Convert this object into a property dictionary. This dictionary can be restored into an object by using @{method:loadFromArray} (unless you're using legacy features with CONFIG_CONVERT_CAMELCASE, but in that case you should just go ahead and die in a fire).
Writing Objects
- public function setID($id) — Set unique ID identifying this object. You normally don't need to call this method unless with `IDS_MANUAL`.
- final public function save()
- public function replace() — Save this object, forcing the query to use REPLACE regardless of object state.
- public function insert() — Save this object, forcing the query to use INSERT regardless of object state.
- public function update() — Save this object, forcing the query to use UPDATE regardless of object state.
- public function delete() — Delete this object, permanently.
- protected function insertRecordIntoDatabase($mode) — Internal implementation of INSERT and REPLACE.
Hooks and Callbacks
- public function getIDKey() — Retrieve the primary key column, "id" by default. If you can not reasonably name your ID column "id", override this method.
- final public function generatePHID()
- protected function willWriteData(&$data)
- protected function didWriteData() — Hook to perform actions after data has been written to the database.
- protected function willSaveObject() — Hook to make internal object state changes prior to INSERT, REPLACE or UPDATE.
- protected function willReadData(&$data)
- protected function didReadData() — Hook to perform an action on data after it is read from the database.
- protected function willDelete() — Hook to perform an action before the deletion of an object.
- protected function didDelete() — Hook to perform an action after the deletion of an object.
- protected function readField($field) — Reads the value from a field. Override this method for custom behavior of @{method:getField} instead of overriding getField directly.
- protected function writeField($field, $value) — Writes a value to a field. Override this method for custom behavior of setField($value) instead of overriding setField directly.
Utilities
- public function __set($name, $value) — Warns against writing to undeclared property.
- protected function applyLiskDataSerialization(&$data, $deserialize) — Applies configured serialization to a dictionary of values.
- public function __call($method, $args) — Black magic. Builds implied get*() and set*() for all properties.
- public static function loadNextCounterValue($conn_w, $counter_name) — Increments a named counter and returns the next value.
- public static function loadCurrentCounterValue($conn_r, $counter_name) — Returns the current value of a named counter.
- public static function overwriteCounterValue($conn_w, $counter_name, $counter_value) — Overwrite a named counter, forcing it to a specific value.
Managing Transactions
- public function beginReadLocking() — Begins read-locking selected rows with SELECT ... FOR UPDATE, so that other connections can not read them (this is an enormous oversimplification of FOR UPDATE semantics; consult the MySQL documentation for details). To end read locking, call @{method:endReadLocking}. For example:
- public function endReadLocking() — Ends read-locking that began at an earlier @{method:beginReadLocking} call.
- public function beginWriteLocking() — Begins write-locking selected rows with SELECT ... LOCK IN SHARE MODE, so that other connections can not update or delete them (this is an oversimplification of LOCK IN SHARE MODE semantics; consult the MySQL documentation for details). To end write locking, call @{method:endWriteLocking}.
- public function endWriteLocking() — Ends write-locking that began at an earlier @{method:beginWriteLocking} call.
Isolation for Unit Testing
- public static function beginIsolateAllLiskEffectsToCurrentProcess()
- public static function endIsolateAllLiskEffectsToCurrentProcess()
- public static function shouldIsolateAllLiskEffectsToCurrentProcess()
- private function establishIsolatedConnection($mode)
- public static function beginIsolateAllLiskEffectsToTransactions()
- public static function endIsolateAllLiskEffectsToTransactions()
- public static function shouldIsolateAllLiskEffectsToTransactions()
UI Integration
- public function getFlavorText() — You can provide an optional piece of flavor text for the application. This is currently rendered in application launch views if the application has no status elements.
- public function buildMainMenuItems($user, $controller) — Build items for the main menu.
URI Routing
Email integration
Fact Integration
Application Management
- final public static function isClassInstalled($class) — Determine if an application is installed, by application class name.
- final public static function isClassInstalledForViewer($class, $viewer) — Determine if an application is installed and available to a viewer, by application class name.
Other Methods
- public function __get($name)
- public function current()
- public function key()
- public function next()
- public function rewind()
- public function valid()
- private function throwOnAttemptedIteration()
- public function getPhobjectClassConstant($key, $byte_limit) — Read the value of a class constant.
- public function __construct() — Build an empty object.
- protected function getDatabaseName()
- protected function loadRawDataWhere($pattern)
- final public function getPHID()
- public function makeEphemeral() — Make an object read-only.
- private function isEphemeralCheck()
- protected function shouldInsertWhenSaved() — Method used to determine whether to insert or update when saving.
- public function getPHIDType()
- public function openTransaction() — Increase transaction stack depth.
- public function saveTransaction() — Decrease transaction stack depth, saving work.
- public function killTransaction() — Decrease transaction stack depth, discarding work.
- public static function closeInactiveConnections($idle_window) — Close any connections with no recent activity.
- public static function closeAllConnections()
- public static function closeIdleConnections()
- private static function closeConnection($key)
- private function getBinaryColumns()
- public function getSchemaColumns()
- public function getSchemaKeys()
- public function getColumnMaximumByteLength($column)
- public function getSchemaPersistence()
- public function getAphrontRefDatabaseName()
- public function getAphrontRefTableName()
- private function getLiskMetadata($key, $default)
- private function setLiskMetadata($key, $value)
- public function setForcedStorageNamespace($namespace)
- private function newClusterConnection($application, $database, $mode)
- private function raiseImproperWrite($database)
- private function raiseImpossibleWrite($database)
- private function raiseUnconfigured($database)
- private function raiseUnreachable($database, $proxy)
- public static function chunkSQL($fragments, $limit) — Break a list of escaped SQL statement fragments (e.g., VALUES lists for INSERT, previously built with @{function:qsprintf}) into chunks which will fit under the MySQL 'max_allowed_packet' limit.
- protected function assertAttached($property)
- protected function assertAttachedKey($value, $key)
- protected function detectEncodingForStorage($string)
- protected function getUTF8StringFromStorage($string, $encoding)
- final public static function getApplicationGroups()
- public function getName()
- public function getShortDescription()
- public function getMonograms() — Extensions are allowed to register multi-character monograms. The name "Monogram" is actually a bit of a misnomer, but we're keeping it due to the history.
- public function isDeprecated()
- final public function isInstalled()
- public function isPrototype()
- public function isUnlisted() — Return `true` if this application should never appear in application lists in the UI. Primarily intended for unit test applications or other pseudo-applications.
- public function isLaunchable() — Return `true` if this application is a normal application with a base URI and a web interface.
- public function isPinnedByDefault($viewer) — Return `true` if this application should be pinned by default.
- final public function isFirstParty() — Returns true if an application is first-party and false otherwise.
- public function canUninstall()
- public function getTypeaheadURI()
- public function getBaseURI()
- final public function getApplicationURI($path)
- public function getIcon()
- public function getApplicationOrder()
- public function getApplicationGroup()
- public function getTitleGlyph()
- final public function getHelpMenuItems($viewer)
- public function getHelpDocumentationArticles($viewer)
- public function getOverview() — Get the Application Overview in raw Remarkup
- public function getEventListeners()
- public function getRemarkupRules()
- public function getQuicksandURIPatternBlacklist()
- public function getMailCommandObjects()
- public function getRoutes()
- public function getResourceRoutes()
- public function supportsEmailIntegration()
- final protected function getInboundEmailSupportLink()
- public function getAppEmailBlurb()
- public function getFactObjectsForAnalysis()
- final public static function getByClass($class_name)
- final public static function getAllApplications()
- final public static function getAllInstalledApplications()
- public function getCapabilities()
- public function getPolicy($capability)
- public function hasAutomaticCapability($capability, $viewer)
- protected function getCustomCapabilities()
- private function getCustomPolicySetting($capability)
- private function getCustomCapabilitySpecification($capability)
- final public function getCapabilityLabel($capability)
- final public function isCapabilityEditable($capability)
- final public function getCapabilityCaption($capability)
- final public function getCapabilityTemplatePHIDType($capability)
- final public function getDefaultObjectTypePolicyMap()
- public function getApplicationSearchDocumentTypes()
- protected function getEditRoutePattern($base)
- protected function getBulkRoutePattern($base)
- protected function getQueryRoutePattern($base)
- protected function getProfileMenuRouting($controller)
- public function getApplicationTransactionEditor()
- public function getApplicationTransactionTemplate()