void &oQuery(
mixed
$className, mixed
$completeQuery, [mixed
$scope = ''])
|
|
It's sufficent that the query only selects the ID $className and result of query must match! $scope and scope of query must match! * --sb OPTIMISATION : Gather all the records at once, instanciate 1 object and duplicate it times rec-number.
* Init each object with rec-data. Pass the list of objects to routine to fetch the chield objects.
FALSE persist(
object
&$obj, [$scope
$scope = ''], [$firstCall
$firstCall = TRUE])
|
|
Persist a object 1) Check if the object passed ($obj) has already been stored. If so, return ID.
This happens evertime a object is referenced by 2 or more vars that have to be persisted. 2) Get the data to be persisted. If we have sub-objects try to start 'Transactions'. 3) First store the 'lonely'-data of the object but only if we detect changes or 'forceSave' is TRUE. 4) Now start saving the sub-objects. Every sub-object saved is noted in the $clearInHouseData hash 5) With the $clearInHouseData all cih-storage tables are updated. 6) Commit if all went well
NOTE I: All exceptions and errors are catched and stored in the error array. See getError_Persist()
Tags:
Overrides
Bs_Object::persist() (Persists this object by serializing it and saving it to a file with unique name.)
Parameters:
FALSE &softDelete(
mixed
$class, [mixed
$classID = -1], [mixed
$scope = ''], [mixed
$firstCall = TRUE])
|
|
Only delete the object (and chield-objects) if no strong references point to it.
We will also try to softDelete the chield-objects unless it's a 'readOnly' ref.
PARAMETERS: $class [string|object]: May be either a className (string) or an object. If it's an object, the className will be fetched trough "get_class($class)" $classID [int] : If $classID > 0, it's expected to be an ID. If $classID < 0, (default) it means: Take ID from passed object: $class using the $_persistTag. $scope string : Sorage area. E.g. the dbName for a underlying SQL-db. See header in Bs_OoDbBasics.class.php $firstCall boolean : Used internaly for recursive calls to softDelete(). No transaction handling ???!
Tags:
NULL &unpersist(
&$class
$class, [$query
$query = -1], [$scope
$scope = ''], [$firstCall
$firstCall = TRUE])
|
|
Unpersist a object - Dramatic dynamic :-) 1) IF className is passed, instanceiate an object(suppressing any missing parameter warnings) ELSE use passed object assuming it's the right class (read on to see what is the *right* class).
The object become to $pObjToPersist 2) IF $query is a positive number >0, we assumed it's the ID of the object-data of the underlying storage. By default it's (-1). That means: use the ID of the $pObjToPersist. If the ID turns out to be 0 or if the object-data is not found return NULL. This may happen quite often. E.g. if we have a weak reference to an object and it was deleted in the mean time. 3) Now fetch the object-data (='lonely'-data) calling fetchObjectData()) and passing the $query. /+°+°+°+° more to come +°+°+°+/ 4) Transform the object-data into the metaData. We skip unknown names; that means varName of the record fileds must match varNames or streamNames from the _ooDbProperty. 5) Merge (reasseble) the metaData with the object. Now all 'lonely'- and 'stream'-data are set. 6) Momorize that this object has already been fetched. 7) Fetch the main clearInHouse records from $pObjToPersist where all object-relations are stored 8) Go through each clearInHouse record by calling the _unpersistObject() function. Collect any error, but woun't interrupt. 'weak'-reference and missing object-data is not an error. 9) If the object was not found return NULL. If all sub-objects where unpersisted successfully return the object otherwise return FALSE.
NOTE I: Calls to _unpersistObject() will do some preparing stuff and then call this function to unpersist the sub-object. It is an intended indirect recursive call. NOTE II: All exceptions and errors are catched and stored in the error array. See getError_Unpersist()
PARAMETERS: $class [string|object]: May be either a className (string) or an object that will be filled with the data. If it's a classname, we will try to instanciate a object with "new $class()". $query [string|int|rs]: A $query is passed 1:1 to the underlying soragehandler. It can be anything the soragehandler can use to identify the object in the database. E.g. If the underlying soragehandler is a SQL-db the query can be an ID, SQL-string or even a record-set. If $query > 0, it's expected to be an ID. If $query < 0, (default) it means: Take ID from passed $class using the $_persistTag. If $query == 0, or ID ends up to be <=0 return NULL; don't fetch any data from storage." $scope string : Sorage area. E.g. the dbName for a underlying SQL-db. See header in Bs_OoDbBasics.class.php $firstCall boolean : Used internaly for recursive calls to unpersist(). RETURN:
- : found no data at all in the underlying storage.
FALSE : Fatal error. Coundn't create the object at all. object: When ever possible an object is returned. *BUT* errors may have happend. To see if errors occured check if getError_Unpersist() returns FALSE. * --sb OPTIMISATION : Gather all the chield-objects of the same type. Analze 1 and den fetch the data in * 1 query.
Tags:
Overrides
Bs_Object::unpersist() (Fetches an object that was persisted with
persist())
Parameters: