DefaultPersistentObject Class Reference

Detailed Description

DefaultPersistentObject is the base class of all persistent objects.

It mainly implements an unique identifier for each instance (ObjectId), tracking of the persistent state, methods for setting and getting values as well as callback methods for lifecycle events.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 34 of file DefaultPersistentObject.php.

+ Inheritance diagram for DefaultPersistentObject:

Public Member Functions

 __construct (ObjectId $oid=null, array $initialData=null)
 
 getType ()
 
 getMapper ()
 
 getOID ()
 
 setOID (ObjectId $oid)
 
 getState ()
 
 setState ($state)
 
 delete ()
 
 __clone ()
 
 copyValues (PersistentObject $object, $copyPkValues=true)
 
 mergeValues (PersistentObject $object)
 
 clearValues ()
 
 afterCreate ()
 
 beforeInsert ()
 
 afterInsert ()
 
 afterLoad ()
 
 beforeUpdate ()
 
 afterUpdate ()
 
 beforeDelete ()
 
 afterDelete ()
 
 getValue ($name)
 
 setValue ($name, $value, $forceSet=false, $trackChange=true)
 
 hasValue ($name)
 
 removeValue ($name)
 
 validateValues ()
 
 validateValue ($name, $value)
 
 getChangedValues ()
 
 getOriginalValues ()
 
 getIndispensableObjects ()
 
 getProperty ($name)
 
 setProperty ($name, $value)
 
 getPropertyNames ()
 
 getValueProperty ($name, $property)
 
 setValueProperty ($name, $property, $value)
 
 getValuePropertyNames ($name)
 
 getValueNames ($excludeTransient=false)
 
 getDisplayValue ()
 
 dump ()
 
 __toString ()
 
 serialize ()
 
 unserialize ($serialized)
 

Protected Member Functions

 setOIDInternal (ObjectId $oid, $triggerListeners)
 
 setValueInternal ($name, $value)
 
 validateValueAgainstValidateType ($name, $value)
 

Additional Inherited Members

- Public Attributes inherited from PersistentObject
const STATE_CLEAN = 0
 
const STATE_DIRTY = 1
 
const STATE_NEW = 2
 
const STATE_DELETED = 3
 

Constructor & Destructor Documentation

__construct ( ObjectId  $oid = null,
array  $initialData = null 
)

Constructor.

The object will be bound to the appropriate PersistenceMapper automatically, if the PersistenceFacade knows the type. The object id is needed to extract the type. If the id parameter of the object id is a dummy id, the object is supposed to be a newly created object (

See also
ObjectId::containsDummyIds()).
Parameters
$oidObjectId instance (optional)
$initialDataAssociative array with initial attribute data to override default data (optional)

Definition at line 59 of file DefaultPersistentObject.php.

Member Function Documentation

getType ( )
See also
PersistentObject::getType()

Implements PersistentObject.

Definition at line 116 of file DefaultPersistentObject.php.

getMapper ( )
See also
PersistentObject::getMapper()

Implements PersistentObject.

Definition at line 123 of file DefaultPersistentObject.php.

getOID ( )
See also
PersistentObject::getOID()

Implements PersistentObject.

Definition at line 133 of file DefaultPersistentObject.php.

setOID ( ObjectId  $oid)
See also
PersistentObject::setOID()

Implements PersistentObject.

Definition at line 140 of file DefaultPersistentObject.php.

setOIDInternal ( ObjectId  $oid,
  $triggerListeners 
)
protected

Set the object id of the PersistentObject.

Parameters
$oidThe PersistentObject's oid.
$triggerListenersBoolean, whether value CahngeListeners should be notified or not

Definition at line 150 of file DefaultPersistentObject.php.

getState ( )
See also
PersistentObject::getState()

Implements PersistentObject.

Definition at line 169 of file DefaultPersistentObject.php.

setState (   $state)
See also
PersistentObject::setState()

Implements PersistentObject.

Definition at line 176 of file DefaultPersistentObject.php.

delete ( )
See also
PersistentObject::delete()

Implements PersistentObject.

Definition at line 208 of file DefaultPersistentObject.php.

__clone ( )
See also
PersistentObject::__clone()

Implements PersistentObject.

Definition at line 216 of file DefaultPersistentObject.php.

copyValues ( PersistentObject  $object,
  $copyPkValues = true 
)
See also
PersistentObject::copyValues()

Implements PersistentObject.

Definition at line 232 of file DefaultPersistentObject.php.

mergeValues ( PersistentObject  $object)
See also
PersistentObject::mergeValues()

Implements PersistentObject.

Definition at line 245 of file DefaultPersistentObject.php.

clearValues ( )
See also
PersistentObject::clearValues()

Implements PersistentObject.

Definition at line 257 of file DefaultPersistentObject.php.

afterCreate ( )
See also
PersistentObject::afterCreate()
Note
The default implementation does nothing

Implements PersistentObject.

Definition at line 286 of file DefaultPersistentObject.php.

beforeInsert ( )
See also
PersistentObject::beforeInsert()
Note
The default implementation does nothing

Implements PersistentObject.

Definition at line 292 of file DefaultPersistentObject.php.

afterInsert ( )
See also
PersistentObject::afterInsert()
Note
The default implementation does nothing

Implements PersistentObject.

Definition at line 298 of file DefaultPersistentObject.php.

afterLoad ( )
See also
PersistentObject::afterLoad()
Note
The default implementation does nothing

Implements PersistentObject.

Definition at line 304 of file DefaultPersistentObject.php.

beforeUpdate ( )
See also
PersistentObject::beforeUpdate()
Note
The default implementation does nothing

Implements PersistentObject.

Definition at line 310 of file DefaultPersistentObject.php.

afterUpdate ( )
See also
PersistentObject::afterUpdate()
Note
The default implementation does nothing

Implements PersistentObject.

Definition at line 316 of file DefaultPersistentObject.php.

beforeDelete ( )
See also
PersistentObject::beforeDelete()
Note
The default implementation does nothing

Implements PersistentObject.

Definition at line 322 of file DefaultPersistentObject.php.

afterDelete ( )
See also
PersistentObject::afterDelete()
Note
The default implementation does nothing

Implements PersistentObject.

Definition at line 328 of file DefaultPersistentObject.php.

getValue (   $name)
See also
PersistentObject::getValue()

Implements PersistentObject.

Definition at line 333 of file DefaultPersistentObject.php.

setValue (   $name,
  $value,
  $forceSet = false,
  $trackChange = true 
)
See also
PersistentObject::setValue()

Implements PersistentObject.

Definition at line 343 of file DefaultPersistentObject.php.

setValueInternal (   $name,
  $value 
)
protected

Internal (fast) version to set a value without any validation, state change, listener notification etc.

Parameters
$nameThe name of the value
$valueThe value

Definition at line 370 of file DefaultPersistentObject.php.

hasValue (   $name)
See also
PersistentObject::hasValue()

Implements PersistentObject.

Definition at line 377 of file DefaultPersistentObject.php.

removeValue (   $name)
See also
PersistentObject::removeValue()

Implements PersistentObject.

Definition at line 384 of file DefaultPersistentObject.php.

validateValues ( )
validateValue (   $name,
  $value 
)
See also
PersistentObject::validateValue()

Implements PersistentObject.

Definition at line 413 of file DefaultPersistentObject.php.

validateValueAgainstValidateType (   $name,
  $value 
)
protected

Check a value's value against the validation type set on it.

This method uses the validateType property of the attribute definition. Throws a ValidationException if the value is not valid.

Parameters
$nameThe name of the item to set.
$valueThe value of the item.

Definition at line 424 of file DefaultPersistentObject.php.

getChangedValues ( )
getOriginalValues ( )
getIndispensableObjects ( )
getProperty (   $name)
See also
PersistentObject::getProperty()

Implements PersistentObject.

Definition at line 470 of file DefaultPersistentObject.php.

setProperty (   $name,
  $value 
)
See also
PersistentObject::setProperty()

Implements PersistentObject.

Definition at line 487 of file DefaultPersistentObject.php.

getPropertyNames ( )
getValueProperty (   $name,
  $property 
)
setValueProperty (   $name,
  $property,
  $value 
)
getValuePropertyNames (   $name)
getValueNames (   $excludeTransient = false)
See also
PersistentObject::getValueNames()

Implements PersistentObject.

Definition at line 552 of file DefaultPersistentObject.php.

getDisplayValue ( )
See also
PersistentObject::getDisplayValue()
Note
Subclasses will override this for special application requirements

Implements PersistentObject.

Definition at line 571 of file DefaultPersistentObject.php.

dump ( )
See also
PersistentObject::dump()

Implements PersistentObject.

Definition at line 578 of file DefaultPersistentObject.php.

__toString ( )

Get a string representation of the PersistentObject.

Returns
String

Definition at line 622 of file DefaultPersistentObject.php.

serialize ( )

Definition at line 626 of file DefaultPersistentObject.php.

unserialize (   $serialized)

Definition at line 631 of file DefaultPersistentObject.php.