Overview

An SQL-centric Model class based on TableDataGateway, using Collection and Record objects for returns, with integrated caching of versioned result data.

Package

This class is part of the Solar_Sql_Model package.

Inheritance:

Configuration Keys

  • catalog: A Solar_Sql_Model_Catalog to find other models with.

  • sql: A Solar_Sql dependency.

  • cache: A Solar_Cache dependency for the Solar_Sql_Model_Cache object.

  • table_scan: Connect to the database and scan the table for its column descriptions, creating the table and indexes if not already present.

  • auto_cache: Automatically maintain the data cache.

Constants

None.

Public Properties

The Solar_Sql_Model class has no public properties; try the list of all properties.

Public Methods

These are all the public methods in the Solar_Sql_Model class.

You can also view the list of all public, protected, and private methods.

__call()

Magic call implements "fetchOneBy...()" and "fetchAllBy...()" for columns listed in the method name.

__construct()

Constructor.

__destruct()

Default destructor; does nothing other than provide a safe fallback for calls to parent::__destruct().

__get()

Read-only access to protected model properties.

countPages()

Fetches count and pages of available records.

delete()

Deletes rows from the model table and deletes cache entries.

dump()

Convenience method for getting a dump the whole object, or one of its properties, or an external variable.

fetch()

Fetches a record or collection by primary key value(s).

fetchAll()

Fetches a collection of all records by arbitrary parameters.

fetchAllAsArray()

Fetches an array of rows by arbitrary parameters.

fetchAssoc()

The same as fetchAll(), except the record collection is keyed on the first column of the results (instead of being a strictly sequential array.)

fetchAssocAsArray()

The same as fetchAssoc(), except it returns an array, not a collection.

fetchCol()

Fetches a sequential array of values from the model, using only the first column of the results.

fetchNew()

Returns a new record with default values.

fetchOne()

Fetches one record by arbitrary parameters.

fetchOneAsArray()

The same as fetchOne(), but returns an array instead of a record object.

fetchPairs()

Fetches an array of key-value pairs from the model, where the first column is the key and the second column is the value.

fetchValue()

Fetches a single value from the model (i.e., the first column of the first record of the returned page set).

free()

Call this before you unset the instance so that you release the memory from all the internal child objects.

getAffectedRows()

Returns the number of rows affected by the last INSERT, UPDATE, or DELETE.

getConditions()

Returns a WHERE clause array of conditions to use when fetching from this model; e.g., single-table inheritance.

getPaging()

Gets the number of records per page.

getPrimary()

Returns the fully-qualified primary key name.

getRelated()

Gets the control object for a named relationship.

insert()

Inserts one row to the model table and deletes cache entries.

isInherit()

Does this model have single-table inheritance values?

locale()

Looks up class-specific locale strings based on a key.

newCollection()

Returns the appropriate collection object for this model.

newRecord()

Returns the appropriate record object, honoring inheritance.

newSelect()

Returns a new Solar_Sql_Select tool, with the proper SQL object injected automatically.

serializeCols()

Serializes data values in-place based on $this->_serialize_cols and $this->_xmlstruct_cols.

setPaging()

Sets the number of records per page.

unserializeCols()

Un-serializes data values in-place based on $this->_serialize_cols and $this->_xmlstruct_cols.

update()

Updates rows in the model table and deletes cache entries.



Local