CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Item Class Reference

Common base class for persistent items store in database. More...

Inheritance diagram for Item:
[legend]

## Public Member Functions
| __construct ($Id)
| Constructor, used to load existing items. More...
| Delete ()
| Destroy item. More...
| Id ()
| Get item ID. More...

## Static Public Member Functions
static | GetCanonicalId ($Id)
| Normalize item ID to canonical form. More...
static | ItemExists ($Id)
| Check whether an item exists with the specified ID. More...

## Protected Member Functions
| UpdateValue ($ColumnName, $NewValue=DB_NOVALUE)
| Convenience function to supply parameters to Database->UpdateValue(). More...

## Static Protected Member Functions
static | CreateWithValues ($Values)
| Create a new item, using specified initial database values. More...
static | SetDatabaseAccessValues ($ClassName)
| Set the database access values (table name, ID column name, name column name) for specified class. More...

## Protected Attributes
| $DB
| $Id
| $ItemIdColumnName
| $ItemNameColumnName
| $ItemTableName
| $ValueCache = array()

## Static Protected Attributes
static | $ItemIdColumnNames
static | $ItemNameColumnNames
static | $ItemTableNames

## Detailed Description

Common base class for persistent items store in database.

Definition at line 13 of file Item.php.

## Constructor & Destructor Documentation

Item::__construct | ( |  | $Id | ) |

Constructor, used to load existing items.

To create new items, child classes should implement a static Create() method.

Parameters

  mixed | $Id | ID of item to load, in a form resolvable by GetCanonicalId().

See also
  Create()
  GetCanonicalId()

Definition at line 26 of file Item.php.

References $Id, and Id().

## Member Function Documentation

static Item::CreateWithValues | ( |  | $Values | ) |
| static protected

Create a new item, using specified initial database values.

Parameters

  array | $Values | Values to set database columns to for new item, with column names for the index.

Returns
  object Newly-created item.

Definition at line 132 of file Item.php.

References $DB.

Item::Delete | ( |  | ) |

Destroy item.

Item object should no longer be used after this call.

Definition at line 56 of file Item.php.

References Id().

static Item::GetCanonicalId | ( |  | $Id | ) |
| static

Normalize item ID to canonical form.

Parameters

  mixed | $Id | ID to normalize.

Returns
  int Canonical ID.

Definition at line 77 of file Item.php.

References $Id.

Item::Id | ( |  | ) |

Get item ID.

Returns
  int Canonical item ID.

Definition at line 67 of file Item.php.

References $Id.

Referenced by __construct(), Delete(), and UpdateValue().

Here is the caller graph for this function:

static Item::ItemExists | ( |  | $Id | ) |
| static

Check whether an item exists with the specified ID.

This only checks whether there is an entry for an item with the specified ID in the database – it does not check anything else (e.g. the type of the item).

Parameters

  int | $Id | ID to check.

Returns
  bool TRUE if item exists with ID, otherwise FALSE.

Definition at line 89 of file Item.php.

References $DB, and $Id.

Referenced by ResourceFactory\DuplicateResource().

Here is the caller graph for this function:

static Item::SetDatabaseAccessValues | ( |  | $ClassName | ) |
| static protected

Set the database access values (table name, ID column name, name column name) for specified class.

This may be overridden in a child class, if different values are needed.

Parameters

  string | $ClassName | Class to set values for.

Definition at line 172 of file Item.php.

References StdLib\Pluralize().

Item::UpdateValue | ( |  | $ColumnName,
|  |  | $NewValue = `DB_NOVALUE`
| ) |  |
| protected

Convenience function to supply parameters to Database->UpdateValue().

Parameters

  string | $ColumnName | Name of database column.
  string | $NewValue | New value for field. (OPTIONAL)

Returns
  string Return value from Database::UpdateValue().

See also
  Database::UpdateValue()

Definition at line 189 of file Item.php.

References Id().

Referenced by Classification\FieldId(), Classification\LinkString(), Classification\QualifierId(), Classification\RecalcDepthAndFullName(), Classification\RecalcResourceCount(), and Classification\SegmentName().

Here is the caller graph for this function:

## Member Data Documentation

Item::$DB
| protected

Definition at line 115 of file Item.php.

Referenced by Resource\Classifications(), Resource\Clear(), Classification\Create(), Resource\Create(), CreateWithValues(), Resource\Delete(), Resource\GetSchemaForResource(), Resource\IsTempResource(), ItemExists(), Resource\Rating(), and Resource\Set().

Item::$Id
| protected

Definition at line 116 of file Item.php.

Referenced by __construct(), Resource\Clear(), Resource\Create(), GetCanonicalId(), Id(), Classification\Id(), Resource\Id(), Resource\IsTempResource(), ItemExists(), Classification\RecalcResourceCount(), and Resource\Set().

Item::$ItemIdColumnName
| protected

Definition at line 117 of file Item.php.

Item::$ItemIdColumnNames
| static protected

Definition at line 122 of file Item.php.

Item::$ItemNameColumnName
| protected

Definition at line 118 of file Item.php.

Item::$ItemNameColumnNames
| static protected

Definition at line 123 of file Item.php.

Item::$ItemTableName
| protected

Definition at line 119 of file Item.php.

Item::$ItemTableNames
| static protected

Definition at line 124 of file Item.php.

Item::$ValueCache = array()
| protected

Definition at line 120 of file Item.php.

The documentation for this class was generated from the following file:

- lib/ScoutLib/Item.php