Public Member Functions | |
getAttributes () | |
Retrieves the names of all the object's attributes. | |
getFields () | |
Retrieves the names of all the object's fields. | |
getId () | |
Retrieves object ID. | |
getReason () | |
Retrieves user-targetted error message. | |
getType () | |
Retrieves the object type. | |
getValues () | |
Retrieves values for all fields in the object. | |
isLoaded ($field) | |
Determines whether a field has been loaded. | |
isValid () | |
Returns whether object is valid. |
This class essentially provides utility methods and features to make it easier to implement the derived classes. Most notably, it supports fields and attributes, as well as autoloader methods, so that objects can easily have lazy loading of database attributes and other fields, for performance reasons.
SnapObject::getAttributes | ( | ) |
Retrieves the names of all the object's attributes.
Note that these attributes are also fields. For objects which do not have a direct database representation, there should be no attributes (e.g., SnapPermission).
SnapObject::getFields | ( | ) |
Retrieves the names of all the object's fields.
SnapObject::getId | ( | ) |
Retrieves object ID.
All Snap objects should have an ID of some sort. For those objects which correspond to database entities, the ID will be the primary key of the row that the object represents. For those objects which do not correspond to database entities (such as SnapPermission), the ID still uniquely represents the object in some useful way.
SnapObject::getReason | ( | ) |
Retrieves user-targetted error message.
This is used primarily by the _canXxx() methods to indicate why an operation could not be performed. To display an error message to the user, call this method.
SnapObject::getType | ( | ) |
Retrieves the object type.
SnapObject::getValues | ( | ) |
Retrieves values for all fields in the object.
Note that this method will NOT autoload unloaded fields. If you want those values returned here, you must trigger an autoload by, e.g., calling getXxx() where "Xxx" is the name of the field that needs to be autoloaded.
SnapObject::isLoaded | ( | $ | field | ) |
Determines whether a field has been loaded.
$field | [string]: which field to check |
SnapObject::isValid | ( | ) |
Returns whether object is valid.
See setValid() for more on what it means for an object to be valid