Свойство | Тип | Описание | |
---|---|---|---|
$m_columnNames | array | Redefine this in the subclass. | |
$m_data | array | An array of (ColumnName => Value). | |
$m_dbTableName | string | Redefine this in the subclass. | |
$m_exists | boolean | TRUE if the object exists in the database, FALSE if not, NULL if unknown. | |
$m_keyColumnNames | array | Redefine this in the subclass. | |
$m_keyIsAutoIncrement | boolean | Whether or not the primary key is an auto-increment field. | |
$m_oldKeyValues | array | If the key values of an object are changed, we need to remember the old values in order to change to the new values. This is the array of the old values. |
Свойство | Тип | Описание | |
---|---|---|---|
$eventDispatcher | Newscoop\EventDispatcher\EventDispatcher | ||
$resourceNames | array |
Метод | Описание | |
---|---|---|
DatabaseObject ( array $p_columnNames = null ) | DatabaseObject represents a row in a database table. | |
GetUseCache ( ) : boolean | Returns true if cache use was enabled | |
ProcessOptions ( string $p_queryStr, array $p_sqlOptions ) : string | This is used by subclasses to add extra SQL options to the end of a query. | |
Search ( $p_className, array $p_columns = null, array $p_sqlOptions = null ) : array | Do a simple search. | |
SetUseCache ( boolean $p_useCache ) : void | Sets cache enabled/disabled | |
commit ( array $p_ignoreColumns = null ) : boolean | Commit the data stored in memory to the database. | |
create ( array $p_values = null ) : boolean | Create the record in the database for this object. | |
delete ( ) : boolean | Delete the row from the database. | |
dumpToHtml ( ) : void | Output the raw values of this object so that it displays nice in HTML. | |
duplicateObject ( object $p_source ) : object | Copies the given object | |
exists ( ) : boolean | Return true if the object exists in the database. | |
fetch ( array $p_recordSet = null, boolean $p_forceExists = false ) : boolean | Fetch a single record from the database for the given key. | |
getCacheKey ( $p_recordSet = null ) | Generates the cache key for the object. | |
getColumnNames ( boolean $p_withTablePrefix = false ) : array | Return the column names of this table. | |
getData ( ) : array | Return the row as an array indexed by the column names. | |
getDbTableName ( ) : string | Return the name of the database table. | |
getKey ( ) : array | Return the key as an array indexed by column names. | |
getKeyColumnNames ( ) : array | Return the column names used for the primary key. | |
getKeyWhereClause ( ) : string | Return a string for the primary key of the table. | |
getProperty ( string $p_dbColumnName, boolean $p_forceFetchFromDatabase = false ) : mixed | Return the data stored in the given column. | |
keyValuesExist ( $p_recordSet = null ) : boolean | Return true if the object has all the values required to fetch a unique record from the table. | |
modifyKeyValue ( string $p_columnName, string $p_value ) : void | Remember the old value of the key. | |
readFromCache ( array $p_recordSet = null ) : mixed | Initializes the current object from cache if it exists | |
resetCache ( ) | ||
sameAs ( mix $p_otherObject ) : boolean | Returns true if the current object is the same type as the given object then has the same value. | |
setColumnNames ( array $p_columnNames ) : void | Initialize the column names for this object. | |
setEventDispatcher ( Newscoop\EventDispatcher\EventDispatcher $dispatcher ) : void | Set event dispatcher. | |
setKey ( array $p_columnNames ) : void | This function has two modes of operation: You can change the columns used for the key values, or you can change the key values themselves. | |
setProperty ( string $p_dbColumnName, string $p_value, boolean $p_commit = true, boolean $p_isSql = false ) : boolean | Set the given column name to the given value. | |
setResourceNames ( array $names ) : void | Set resource names. | |
update ( array $p_columns = null, boolean $p_commit = true, boolean $p_isSql = false ) : boolean | Update the database row with the given values. | |
writeCache ( ) : boolean | Writes the object to cache. |
Метод | Описание | |
---|---|---|
dispatchEvent ( string $event, string $subject, array $params = [] ) | Dispatch event. | |
getResourceName ( ) : string | Get resource name. | |
lockTables ( array $p_tables = [], $p_write = true ) | fn getCacheKey | |
unlockTables ( ) |
public DatabaseObject ( array $p_columnNames = null ) | ||
$p_columnNames | array | The column names of this table. These are optional. |
public GetUseCache ( ) : boolean | ||
Результат | boolean |
public static ProcessOptions ( string $p_queryStr, array $p_sqlOptions ) : string | ||
$p_queryStr | string | The current SQL query. |
$p_sqlOptions | array | Available options: 'LIMIT' => [max_rows_to_fetch] 'LIMIT' => array('START'=>[Starting_index],'MAX_ROWS'=>[Max_rows_to_fetch] 'ORDER BY' => [column_name] 'ORDER BY' => array([column_name_1], [column_name_2], ...) 'ORDER BY' => array([column_name_1]=>[ASC|DESC], [column_name_2]=>[ASC|DESC], ...) |
Результат | string | Original SQL query with the options appended at the end. |
public SetUseCache ( boolean $p_useCache ) : void | ||
$p_useCache | boolean | |
Результат | void |
public dumpToHtml ( ) : void | ||
Результат | void |
public duplicateObject ( object $p_source ) : object | ||
$p_source | object | |
Результат | object |
public fetch ( array $p_recordSet = null, boolean $p_forceExists = false ) : boolean | ||
$p_recordSet | array | If the record has already been fetched and we just need to assign the data to the object's internal member variable. |
$p_forceExists | boolean | prevents to check for the object existence in the database, a performance thing for situations where we know it exists. |
Результат | boolean | TRUE on success, FALSE on failure |
public getCacheKey ( $p_recordSet = null ) |
public getColumnNames ( boolean $p_withTablePrefix = false ) : array | ||
$p_withTablePrefix | boolean | Set to true if you want to prefix the column names with the table name. Default is false. |
Результат | array |
public getDbTableName ( ) : string | ||
Результат | string |
public getKeyColumnNames ( ) : array | ||
Результат | array |
public getKeyWhereClause ( ) : string | ||
Результат | string |
public getProperty ( string $p_dbColumnName, boolean $p_forceFetchFromDatabase = false ) : mixed | ||
$p_dbColumnName | string | |
$p_forceFetchFromDatabase | boolean | Get the data from the database instead of cached value that is stored in the object. |
Результат | mixed | Return a string if the property exists, NULL if the value doesnt exist, or a PEAR_Error if $p_forceFetchFromDatabase is TRUE and there was a problem fetching the data. |
protected getResourceName ( ) : string | ||
Результат | string |
public keyValuesExist ( $p_recordSet = null ) : boolean | ||
Результат | boolean |
protected lockTables ( array $p_tables = [], $p_write = true ) | ||
$p_tables | array |
public readFromCache ( array $p_recordSet = null ) : mixed | ||
$p_recordSet | array | |
Результат | mixed | object The cached object on success boolean FALSE if the object did not exist |
public setColumnNames ( array $p_columnNames ) : void | ||
$p_columnNames | array | The column names in the database. |
Результат | void |
public static setEventDispatcher ( Newscoop\EventDispatcher\EventDispatcher $dispatcher ) : void | ||
$dispatcher | Newscoop\EventDispatcher\EventDispatcher | |
Результат | void |
public setProperty ( string $p_dbColumnName, string $p_value, boolean $p_commit = true, boolean $p_isSql = false ) : boolean | ||
$p_dbColumnName | string | The name of the column that is to be updated. |
$p_value | string | The value to set. |
$p_commit | boolean | If set to true, the value will be written to the database immediately. If set to false, the value will not be written to the database. Default is true. |
$p_isSql | boolean | Set this to TRUE if p_value consists of SQL commands. There is no way to know what the result of the command is, so we will need to refetch the value from the database in order to update the internal variable's value. |
Результат | boolean | TRUE on success, FALSE on error. |
public static setResourceNames ( array $names ) : void | ||
$names | array | |
Результат | void |
public update ( array $p_columns = null, boolean $p_commit = true, boolean $p_isSql = false ) : boolean | ||
$p_columns | array | Array of (Column_Name => Value) |
$p_commit | boolean | If set to true, the value will be written to the database immediately. If set to false, the value will not be written to the database. Default is true. |
$p_isSql | boolean | Set this to TRUE if the values of p_columns contains SQL commands. There is no way to know what the result of the command is, so we will need to refetch the row from the database in order to update the internal variable's value. |
Результат | boolean | Return TRUE on success, FALSE on error. |
public writeCache ( ) : boolean | ||
Результат | boolean | TRUE on success, FALSE on failure |
protected static EventDispatcher,Newscoop\EventDispatcher $eventDispatcher | ||
Результат | Newscoop\EventDispatcher\EventDispatcher |
public array $m_columnNames | ||
Результат | array |
public string $m_dbTableName | ||
Результат | string |
public bool $m_exists | ||
Результат | boolean |
public array $m_keyColumnNames | ||
Результат | array |
public bool $m_keyIsAutoIncrement | ||
Результат | boolean |
public array $m_oldKeyValues | ||
Результат | array |
protected static array $resourceNames | ||
Результат | array |