PiiUser

Package pii.core.user
Inheritance class PiiUser » CActiveRecord » CModel » CComponent
Implements IteratorAggregate, Traversable, ArrayAccess
Since 2.0
Version $Id$
Model class

Detailed info
$var = code_example();
DefaultController

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
attributes array Returns all column attribute values. CActiveRecord
commandBuilder CDbCommandBuilder the command builder used by this AR CActiveRecord
db CDbConnection the default database connection for all active record classes. CActiveRecord
dbConnection CDbConnection Returns the database connection used by active record. CActiveRecord
dbCriteria CDbCriteria Returns the query criteria associated with this model. CActiveRecord
errors array Returns the errors for all attribute or a single attribute. CModel
isNewRecord boolean whether the record is new and should be inserted when calling save. CActiveRecord
iterator CMapIterator Returns an iterator for traversing the attributes in the model. CModel
metaData CActiveRecordMetaData the meta for this AR class. CActiveRecord
newpassword string newpassword form field PiiUser
oldPrimaryKey mixed Returns the old primary key value. CActiveRecord
primaryKey mixed the primary key value. CActiveRecord
profile CActiveRecord Profile model, if exists PiiUser
repeatpassword string repeatpassword form field PiiUser
safeAttributeNames array Returns the attribute names that are safe to be massively assigned. CModel
scenario string Returns the scenario that this model is used in. CModel
status int Default status: STATUS_NEW PiiUser
statusName string Name of the current status or empty string if unknown PiiUser
tableSchema CDbTableSchema the metadata of the table that this AR belongs to CActiveRecord
username PiiUser
validators array Returns the validators applicable to the current scenario. CModel

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. CActiveRecord
__construct() Constructor. CActiveRecord
__get() PHP getter magic method. CActiveRecord
__isset() Checks if a property value is null. CActiveRecord
__set() PHP setter magic method. CActiveRecord
__sleep() PHP sleep magic method. CActiveRecord
__unset() Sets a component property to be null. CActiveRecord
addError() Adds a new error to the specified attribute. CModel
addErrors() Adds a list of errors. CModel
addRelatedRecord() Adds a related object to this record. CActiveRecord
afterFindInternal() Calls afterFind. CActiveRecord
asa() Returns the named behavior object. CComponent
attachBehavior() Attaches a behavior to this component. CComponent
attachBehaviors() Attaches a list of behaviors to the component. CComponent
attachEventHandler() Attaches an event handler to an event. CComponent
attributeLabels() PiiUser
attributeNames() Returns the list of all attribute names of the model. CActiveRecord
beforeSave() Create hashed password if new password is set PiiUser
behaviors() PiiUser
canGetProperty() Determines whether a property can be read. CComponent
canSetProperty() Determines whether a property can be set. CComponent
clearErrors() Removes errors for all attributes or a single attribute. CModel
count() Finds the number of rows satisfying the specified query condition. CActiveRecord
countBySql() Finds the number of rows using the given SQL statement. CActiveRecord
createToken() Creates and saves a new user token. PiiUser
createValidators() Creates validator objects based on the specification in rules. CModel
defaultScope() Returns the default named scope that should be implicitly applied to all queries for this model. CActiveRecord
delete() Deletes the row corresponding to this active record. CActiveRecord
deleteAll() Deletes rows with the specified condition. CActiveRecord
deleteAllByAttributes() Deletes rows which match the specified attribute values. CActiveRecord
deleteByPk() Deletes rows with the specified primary key. CActiveRecord
detachBehavior() Detaches a behavior from the component. CComponent
detachBehaviors() Detaches all behaviors from the component. CComponent
detachEventHandler() Detaches an existing event handler. CComponent
disableBehavior() Disables an attached behavior. CComponent
disableBehaviors() Disables all behaviors attached to this component. CComponent
enableBehavior() Enables an attached behavior. CComponent
enableBehaviors() Enables all behaviors attached to this component. CComponent
equals() Compares this active record with another one. CActiveRecord
exists() Checks whether there is row satisfying the specified condition. CActiveRecord
find() Finds a single active record with the specified condition. CActiveRecord
findAll() Finds all active records satisfying the specified condition. CActiveRecord
findAllByAttributes() Finds all active records that have the specified attribute values. CActiveRecord
findAllByPk() Finds all active records with the specified primary keys. CActiveRecord
findAllBySql() Finds all active records using the specified SQL statement. CActiveRecord
findByAttributes() Finds a single active record that has the specified attribute values. CActiveRecord
findByPk() Finds a single active record with the specified primary key. CActiveRecord
findBySql() Finds a single active record with the specified SQL statement. CActiveRecord
findByToken() Finds a record by a given token. If the token is PiiUser
generateAttributeLabel() Generates a user friendly attribute label. CModel
getActiveRelation() CActiveRecord
getAttribute() Returns the named attribute value. CActiveRecord
getAttributeLabel() Returns the text label for the specified attribute. CModel
getAttributes() Returns all column attribute values. CActiveRecord
getCommandBuilder() CActiveRecord
getDbConnection() Returns the database connection used by active record. CActiveRecord
getDbCriteria() Returns the query criteria associated with this model. CActiveRecord
getError() Returns the first error of the specified attribute. CModel
getErrors() Returns the errors for all attribute or a single attribute. CModel
getEventHandlers() Returns the list of attached event handlers for an event. CComponent
getIsNewRecord() CActiveRecord
getIterator() Returns an iterator for traversing the attributes in the model. CModel
getMetaData() CActiveRecord
getOldPrimaryKey() Returns the old primary key value. CActiveRecord
getPrimaryKey() CActiveRecord
getProfile() PiiUser
getRelated() Returns the related record(s). CActiveRecord
getSafeAttributeNames() Returns the attribute names that are safe to be massively assigned. CModel
getScenario() Returns the scenario that this model is used in. CModel
getStatusName() PiiUser
getTableSchema() CActiveRecord
getUsername() PiiUser
getValidators() Returns the validators applicable to the current scenario. CModel
hasAttribute() CActiveRecord
hasChangedEmail() PiiUser
hasChangedPassword() PiiUser
hasErrors() Returns a value indicating whether there is any validation error. CModel
hasEvent() Determines whether an event is defined. CComponent
hasEventHandler() Checks whether the named event has attached handlers. CComponent
hasProperty() Determines whether a property is defined. CComponent
hasRelated() Returns a value indicating whether the named related object(s) has been loaded. CActiveRecord
init() Initializes this model. CActiveRecord
insert() Inserts a row into the table based on this active record attributes. CActiveRecord
isAttributeRequired() Returns a value indicating whether the attribute is required. CModel
isAttributeSafe() Returns a value indicating whether the attribute is safe for massive assignments. CModel
model() Returns the static model of the specified AR class. PiiUser
offsetExists() Returns whether there is an element at the specified offset. CActiveRecord
offsetGet() Returns the element at the specified offset. CModel
offsetSet() Sets the element at the specified offset. CModel
offsetUnset() Unsets the element at the specified offset. CModel
onAfterConstruct() This event is raised after the record instance is created by new operator. CActiveRecord
onAfterDelete() This event is raised after the record is deleted. CActiveRecord
onAfterFind() This event is raised after the record is instantiated by a find method. CActiveRecord
onAfterSave() This event is raised after the record is saved. CActiveRecord
onAfterValidate() This event is raised after the validation is performed. CModel
onBeforeDelete() This event is raised before the record is deleted. CActiveRecord
onBeforeFind() This event is raised before an AR finder performs a find call. CActiveRecord
onBeforeSave() This event is raised before the record is saved. CActiveRecord
onBeforeValidate() This event is raised before the validation is performed. CModel
populateRecord() Creates an active record with the given attributes. CActiveRecord
populateRecords() Creates a list of active records based on the input data. CActiveRecord
primaryKey() Returns the primary key of the associated database table. CActiveRecord
raiseEvent() Raises an event. CComponent
refresh() Repopulates this active record with the latest data. CActiveRecord
refreshMetaData() Refreshes the meta data for this AR class. CActiveRecord
relations() PiiUser
rules() PiiUser
safeAttributes() PiiUser
save() Saves the current record. CActiveRecord
saveAttributes() Saves a selected list of attributes. CActiveRecord
scopes() Returns the declaration of named scopes. CActiveRecord
setAttribute() Sets the named attribute value. CActiveRecord
setAttributes() Sets the attribute values in a massive way. CModel
setIsNewRecord() CActiveRecord
setPrimaryKey() Sets the primary key value. CActiveRecord
setScenario() CModel
setUsername() PiiUser
statusOptions() PiiUser
tableName() PiiUser
update() Updates the row represented by this active record. CActiveRecord
updateAll() Updates records with the specified condition. CActiveRecord
updateByPk() Updates records with the specified primary key(s). CActiveRecord
updateCounters() Updates one or several counter columns. CActiveRecord
updateEmailAndPassword() Updates email and password from verifyEmail and PiiUser
useVerifiedEmail() Use the saved unverified email address as current address PiiUser
validate() Performs the validation. CModel
with() Specifies which related objects should be eagerly loaded. CActiveRecord

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
afterConstruct() This method is invoked after a record instance is created by new operator. CActiveRecord
afterDelete() This method is invoked after deleting a record. CActiveRecord
afterFind() This method is invoked after each record is instantiated by a find method. CActiveRecord
afterSave() This method is invoked after saving a record. CActiveRecord
afterValidate() This method is invoked after validation ends. CModel
beforeDelete() This method is invoked before deleting a record. CActiveRecord
beforeFind() This method is invoked before an AR finder executes a find call. CActiveRecord
beforeValidate() This method is invoked before validation starts. CModel
instantiate() Creates an active record instance. CActiveRecord

Events

Hide inherited events

EventDescriptionDefined By
onBeforeSave This event is raised before the record is saved. CActiveRecord
onAfterSave This event is raised after the record is saved. CActiveRecord
onBeforeDelete This event is raised before the record is deleted. CActiveRecord
onAfterDelete This event is raised after the record is deleted. CActiveRecord
onAfterConstruct This event is raised after the record instance is created by new operator. CActiveRecord
onBeforeFind This event is raised before an AR finder performs a find call. CActiveRecord
onAfterFind This event is raised after the record is instantiated by a find method. CActiveRecord
onBeforeValidate This event is raised before the validation is performed. CModel
onAfterValidate This event is raised after the validation is performed. CModel

Property Details

newpassword property
public string $newpassword;

newpassword form field

profile property read-only
public CActiveRecord getProfile()

Profile model, if exists

repeatpassword property
public string $repeatpassword;

repeatpassword form field

status property
public int $status;

Default status: STATUS_NEW

statusName property read-only
public string getStatusName()

Name of the current status or empty string if unknown

username property
public void getUsername()
public void setUsername($value)

Method Details

attributeLabels() method
public array attributeLabels()
{return} array customized attribute labels (name=>label)

beforeSave() method
public void beforeSave()

Create hashed password if new password is set

behaviors() method
public array behaviors()
{return} array model behaviours

createToken() method
public string createToken(int $lifetime=3600)
$lifetime int $lifetime
{return} string the new created token

Creates and saves a new user token.

This token will be valid for the specified lifetime.

findByToken() method
public mixed findByToken(string $token, mixed $status=NULL)
$token string $token to search
$status mixed $status only search for given status. Ignored if null.
{return} mixed PiiUser object or null if no valid token.

Finds a record by a given token. If the token is not found or token has expired, null will be returned.

getProfile() method
public CActiveRecord getProfile()
{return} CActiveRecord Profile model, if exists

getStatusName() method
public string getStatusName()
{return} string Name of the current status or empty string if unknown

getUsername() method
public void getUsername()

hasChangedEmail() method
public bool hasChangedEmail()
{return} bool wether there's a changed email in verifyEmail attribute. Returns false if empty.

hasChangedPassword() method
public bool hasChangedPassword()
{return} bool wether there's a changed password in newpassword. Returns false if empty.

model() method
public static CActiveRecord model($className='PiiUser')
$className
{return} CActiveRecord the static model class

Returns the static model of the specified AR class.

relations() method
public array relations()
{return} array relational rules.

rules() method
public array rules()
{return} array validation rules for model attributes.

safeAttributes() method
public void safeAttributes()

setUsername() method
public void setUsername($value)
$value

statusOptions() method
public static array statusOptions()
{return} array list of status options for use in dropdown menus

tableName() method
public string tableName()
{return} string the associated database table name

updateEmailAndPassword() method
public bool updateEmailAndPassword()
{return} bool wether one of the attributes was changed

Updates email and password from verifyEmail and newpassword if one of them was changed.

useVerifiedEmail() method
public bool useVerifiedEmail()
{return} bool false if there's no unverified email adress, true on success.

Use the saved unverified email address as current address and update the attributes accordingly.