Private Method Details |
_setObject |
|
private void _setObject( object [unknown] &$pObj, [ string $scope ] )
|
| |
First thing to do for the basic persister function like persist(), unpersist(), delete()
is to set the object you want to persist/unpersist/delete
|
| Parameter |
|
| object [unknown] |
&$pObj |
|
|
. The object to handle |
|
|
| string |
$scope |
= >>''<< |
|
. The scope to use as *default*. See setScope() and header for details. |
|
| Returns |
void |
|
&_getOoDbProperty |
|
private void &_getOoDbProperty( [ string $useCach ] )
|
| |
Collect Info-Routine I
Get and/or autodetect the persist property that tells us *HOW* and *WHAT* to persist.1) Scan the $pObjToPersist for varName's that have to be persisted2) Use the $_ooDbProperty - hash for varName's that have to be persistedReturns a valid varName-hash with the information on how to store the object vars.Caches the data and returns it by reference, so don't fuck with the data.NOTE: The object to persist should have a variable called '$_ooDbProperty', itwill be used to fetch the persist porfile-data. See header info.Structure sample: (For full sturcture info see header)$_ooDbProperty[$varName] = array('mode' => 'lonely','metaType' => [string|blob|<a phpType>],'relation' => ['strong'|'weak'],'index' => [TRUE|FALSE],'readOnly' => [TRUE|FALSE],'ignor' => [TRUE|FALSE]);
|
| Parameter |
|
| string |
$useCach |
= >>FALSE<< |
|
(default is FALSE). |
|
| Returns |
void |
|
_prepareToPersistData |
|
private void _prepareToPersistData( [ string $useCach ] )
|
| |
Collect Info-Routine II
Collects and prepares all data form the $pObjToPersist and puts it ina $pInfoList - hash.a $_pMeataData - hashThis hash includes the data (*wath* to store) and the property info (*how* to store) *plus* it'sit's split in <storeMode>'s.Goals:0) Sort out data with property-attr 'readOnly'==TRUE or 'ignor'==TRUE.1) Skip <varName> that are is *NOT SET* or are *NULL*.NULL is not a supported value to store. Use some other value.2) Serialize data with property-attr 'mode'=='stream' and put it in the pMetaData marked as 'lonely'3) Get object ID (if present) and put it in the pMetaData marked as 'lonely'4) Calculate the md5 fingerprint and determin if data has changed since last fetch.5) Separate the data by <storeMode>'s ['lonely'|'object']. // sam's ooIn this way we can store all data of <storeMode> == 'lonely' into the unterlying storage andcontinue to process the other <storeMode> types.NOTE: <varName> that are *NOT SET* are treated as 'ignor'.Structure:$pInfoList[<storeMode>][<varName>] = array('data' => <Pointer to the data>;'property' => <Pointer to the propertyInfo of varName>); |Where <storeMode> is one of ['lonely'|'object'] // sam's oo$pMetaData[<varName>] = &<varData>
|
| Parameter |
|
| string |
$useCach |
= >>TRUE<< |
|
default is TRUE. |
|
| Returns |
void |
|
_reassembleObjectMetaData |
|
private void _reassembleObjectMetaData( &$metaData )
|
| |
Write the metaData to the current $pObjToPersist.
metaData is expected only to contain 'lonely'- and 'stream'-mode data.This function will unserialize an handle any stream-data found.We expect to find the object-ID in $metaData['ID']. Set ID to 0 if not found.
|
| Parameter |
|
|
&$metaData |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
|
_memorizeObjStored |
|
private void _memorizeObjStored( object [unknown] &$object )
|
| |
Memorize that the passed object is already stored.
This methode is used to pervent deadlock-loops when objects reference each other.
|
| Parameter |
|
| object [unknown] |
&$object |
|
|
|
|
| Returns |
void |
|
_isObjAlreadyStored |
|
private bool _isObjAlreadyStored( object [unknown] &$object )
|
| |
Check if current pObjToPersist's as already stored.
|
| Parameter |
|
| object [unknown] |
&$object |
|
|
|
|
| Returns |
bool TRUE if already stored, FALSE otherwise |
|
_unMemorizeObjStored |
|
private void _unMemorizeObjStored( )
|
| |
Delete the list of all objects, that have already been put into the storage.
|
| Returns |
void |
|
_memorizeObjFetched |
|
private void _memorizeObjFetched( object [unknown] &$object )
|
| |
Memorize that the passed object is already fetched.
This methode is used to pervent deadlock-loops when objects reference each other.
|
| Parameter |
|
| object [unknown] |
&$object |
|
|
|
|
| Returns |
void |
|
&_getObjAlreadyFetched |
|
private object reference &_getObjAlreadyFetched( string $className, string $objID, string $scope )
|
| |
Check if the desired object is already fetched and return a reference to it if so.
Otherwise return FALSE.
|
| Parameter |
|
| string |
$className |
|
|
. The class name. |
|
|
| string |
$objID |
|
|
The storage ID. |
|
|
| string |
$scope |
|
|
The scope. (See header info) |
|
| Returns |
object reference if already fetched, FALSE otherwise. |
|
_unMemorizeObjFetched |
|
private void _unMemorizeObjFetched( )
|
| |
Delete the list of all objects, that have already been fetched.
|
| Returns |
void |
|
&_calcMd5Fingerprint |
|
private string &_calcMd5Fingerprint( &$pMetaData )
|
| |
Makes the md5 fingerprint calculation.
Just takes a hash, sorts it, serializes it and returns the md5 fingerprint
|
| Parameter |
|
|
&$pMetaData |
|
|
Warning: documentation is missing. |
|
| Returns |
string Of 32 char md5 fingerprint. (See text) |
|
&_flattenObjArray |
|
private void &_flattenObjArray( array &$objTree, object [unknown] &$objList, [ string $hashPrefix, integer $treeDepth ] )
|
| |
We need this function to handle objArray-trees.
As input we expect an array-tree (vector or hash) of objects.As output we want a flattend 1-D hash. (See sample below).We do this by makeing a CSV hash-key. On unpersisting we unflattenthe tree in the opposit way.NOTE I: We follow a branch to a maximum depth of 7 to prevent endles looping.NOTE II: Sorry, but I can't handle array-cycles. It's a PHP 4.x problem!E.g. $a=$b=NULL; a$=array('b'=>&$b); b$=array('a'=>&$a);The funtion woun't crash but cycle 7x producing a wrong array.Sample:INPUTroot['root'] = array('a1'=>array('b1'=>$obj, 'b2'=>$obj), 'a2'=>$obj)'root'/ \'a1' 'a2'/ \ |'b1' 'b2' $obj| |$obj $objOUTPUTarray('root;a1;b1'=>$obj, 'root;a1;b2'=>$obj, 'root;a2'=>$obj)
|
| Parameter |
|
| array |
&$objTree |
|
|
. Any hash or vector of objects. |
|
|
| object [unknown] |
&$objList |
|
|
s (used for recursive call) |
|
|
| string |
$hashPrefix |
= >>''<< |
|
CSV-hash prefix (used for recursive call) |
|
|
| integer |
$treeDepth |
= >>0<< |
|
. See NOTE |
|
| Returns |
void |
|
_setError_Store |
|
private void _setError_Store( $varName, &$error, string $type )
|
| |
Warning: documentation is missing.
|
| Parameter |
|
|
$varName |
|
|
Warning: documentation is missing. |
|
|
|
&$error |
|
|
Warning: documentation is missing. |
|
|
| string |
$type |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
|
&getError_Persist |
|
private void &getError_Persist( string $all )
|
| |
Warning: documentation is missing.
|
| Parameter |
|
| string |
$all |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
|
_flattenObjArray |
|
private void _flattenObjArray( &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree, &$objTree )
|
| |
Warning: documentation is missing.
|
| Parameter |
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
|
|
&$objTree |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
|
_setError_Fetch |
|
private void _setError_Fetch( $varName, &$error, string $type )
|
| |
Warning: documentation is missing.
|
| Parameter |
|
|
$varName |
|
|
Warning: documentation is missing. |
|
|
|
&$error |
|
|
Warning: documentation is missing. |
|
|
| string |
$type |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
|
_setError_Delete |
|
private void _setError_Delete( $varName, &$error, string $type )
|
| |
Warning: documentation is missing.
|
| Parameter |
|
|
$varName |
|
|
Warning: documentation is missing. |
|
|
|
&$error |
|
|
Warning: documentation is missing. |
|
|
| string |
$type |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
|
&getError_Unpersist |
|
private void &getError_Unpersist( string $all )
|
| |
Warning: documentation is missing.
|
| Parameter |
|
| string |
$all |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
|
&getError_Delete |
|
private void &getError_Delete( string $all )
|
| |
Warning: documentation is missing.
|
| Parameter |
|
| string |
$all |
|
|
Warning: documentation is missing. |
|
| Returns |
void |
|
&errorDump |
|
private void &errorDump( )
|
| |
Warning: documentation is missing.
|
| Returns |
void |
|