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 ()
 
 reset ()
 
 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 ()
 
 getOriginalValue ($name)
 
 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()

__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)

Reimplemented in Node.

Definition at line 59 of file DefaultPersistentObject.php.

Member Function Documentation

◆ getType()

getType ( )
See also
PersistentObject::getType()

Implements PersistentObject.

Definition at line 116 of file DefaultPersistentObject.php.

◆ getMapper()

getMapper ( )
See also
PersistentObject::getMapper()

Implements PersistentObject.

Definition at line 123 of file DefaultPersistentObject.php.

◆ getOID()

getOID ( )
See also
PersistentObject::getOID()

Implements PersistentObject.

Reimplemented in NullNode.

Definition at line 133 of file DefaultPersistentObject.php.

◆ setOID()

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

Implements PersistentObject.

Definition at line 140 of file DefaultPersistentObject.php.

◆ setOIDInternal()

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()

getState ( )
See also
PersistentObject::getState()

Implements PersistentObject.

Definition at line 169 of file DefaultPersistentObject.php.

◆ setState()

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

Implements PersistentObject.

Definition at line 176 of file DefaultPersistentObject.php.

◆ delete()

delete ( )
See also
PersistentObject::delete()

Implements PersistentObject.

Definition at line 208 of file DefaultPersistentObject.php.

◆ __clone()

__clone ( )
See also
PersistentObject::__clone()

Implements PersistentObject.

Reimplemented in Node.

Definition at line 216 of file DefaultPersistentObject.php.

◆ copyValues()

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

Implements PersistentObject.

Definition at line 234 of file DefaultPersistentObject.php.

◆ mergeValues()

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

Implements PersistentObject.

Reimplemented in Node.

Definition at line 247 of file DefaultPersistentObject.php.

◆ clearValues()

clearValues ( )
See also
PersistentObject::clearValues()

Implements PersistentObject.

Definition at line 259 of file DefaultPersistentObject.php.

◆ reset()

reset ( )
See also
PersistentObject::reset()

Implements PersistentObject.

Definition at line 274 of file DefaultPersistentObject.php.

◆ afterCreate()

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

Implements PersistentObject.

Definition at line 296 of file DefaultPersistentObject.php.

◆ beforeInsert()

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

Implements PersistentObject.

Reimplemented in AbstractUser.

Definition at line 302 of file DefaultPersistentObject.php.

◆ afterInsert()

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

Implements PersistentObject.

Definition at line 308 of file DefaultPersistentObject.php.

◆ afterLoad()

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

Implements PersistentObject.

Definition at line 314 of file DefaultPersistentObject.php.

◆ beforeUpdate()

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

Implements PersistentObject.

Reimplemented in AbstractUser.

Definition at line 320 of file DefaultPersistentObject.php.

◆ afterUpdate()

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

Implements PersistentObject.

Definition at line 326 of file DefaultPersistentObject.php.

◆ beforeDelete()

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

Implements PersistentObject.

Reimplemented in AbstractUser.

Definition at line 332 of file DefaultPersistentObject.php.

◆ afterDelete()

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

Implements PersistentObject.

Definition at line 338 of file DefaultPersistentObject.php.

◆ getValue()

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

Implements PersistentObject.

Reimplemented in Node.

Definition at line 343 of file DefaultPersistentObject.php.

◆ setValue()

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

Implements PersistentObject.

Reimplemented in AbstractUser, and Node.

Definition at line 353 of file DefaultPersistentObject.php.

◆ setValueInternal()

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 380 of file DefaultPersistentObject.php.

◆ hasValue()

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

Implements PersistentObject.

Definition at line 387 of file DefaultPersistentObject.php.

◆ removeValue()

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

Implements PersistentObject.

Reimplemented in Node.

Definition at line 394 of file DefaultPersistentObject.php.

◆ validateValues()

validateValues ( )

◆ validateValue()

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

Implements PersistentObject.

Reimplemented in AbstractUser, and AbstractRole.

Definition at line 423 of file DefaultPersistentObject.php.

◆ validateValueAgainstValidateType()

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 434 of file DefaultPersistentObject.php.

◆ getChangedValues()

getChangedValues ( )

◆ getOriginalValue()

getOriginalValue (   $name)

◆ getIndispensableObjects()

getIndispensableObjects ( )
See also
PersistentObject::getIndispensableObjects()

Implements PersistentObject.

Reimplemented in Node.

Definition at line 479 of file DefaultPersistentObject.php.

◆ getProperty()

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

Implements PersistentObject.

Definition at line 486 of file DefaultPersistentObject.php.

◆ setProperty()

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

Implements PersistentObject.

Definition at line 503 of file DefaultPersistentObject.php.

◆ getPropertyNames()

getPropertyNames ( )

◆ getValueProperty()

getValueProperty (   $name,
  $property 
)

◆ setValueProperty()

setValueProperty (   $name,
  $property,
  $value 
)

◆ getValuePropertyNames()

getValuePropertyNames (   $name)

◆ getValueNames()

getValueNames (   $excludeTransient = false)
See also
PersistentObject::getValueNames()

Implements PersistentObject.

Reimplemented in Node.

Definition at line 568 of file DefaultPersistentObject.php.

◆ getDisplayValue()

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

Implements PersistentObject.

Reimplemented in Node.

Definition at line 587 of file DefaultPersistentObject.php.

◆ dump()

dump ( )
See also
PersistentObject::dump()

Implements PersistentObject.

Definition at line 594 of file DefaultPersistentObject.php.

◆ __toString()

__toString ( )

Get a string representation of the PersistentObject.

Returns
String

Reimplemented in Node.

Definition at line 638 of file DefaultPersistentObject.php.

◆ serialize()

serialize ( )

Definition at line 642 of file DefaultPersistentObject.php.

◆ unserialize()

unserialize (   $serialized)

Definition at line 647 of file DefaultPersistentObject.php.