| core_storage

# Class: Bs_ObjPersisterForFile Source Location: /core/storage/objectpersister/Bs_ObjPersisterForFile.class.php
### Class Overview
    Bs_Object
       |
       --Bs_ObjPersister
          |
          --Bs_ObjPersisterForFile
dependencies: Bs_ObjPersister #### Author(s): andrej arn <at blueshoes dot org> #### Version: 4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:17:49 $ #### Copyright: blueshoes.org | ### Variables $_directory $_path | ### Methods Bs_ObjPersisterForMySql createDirectory dropDirectory getDirectory getPath persist setDirectory setPath unPersist
### Inherited Variables #### Class: Bs_ObjPersister Bs_ObjPersister::$Bs_Rc4Crypt Bs_ObjPersister::$rc4key Bs_ObjPersister::$_objToPersist Bs_ObjPersister::$_persistInfo | ### Inherited Methods #### Class: Bs_ObjPersister Bs_ObjPersister::Bs_ObjPersister() Constuctor. Bs_ObjPersister::getPersistInfo() Returns a hash with the *cleaned* persist information thst was retrieved from the persist hint hash and by analysing the target object itself. Bs_ObjPersister::isReservedWord() The following words are explicitly reserved in MySQL and most of them are forbidden by ANSI SQL92 Bs_ObjPersister::persist() Persist the object that is handeled by this object. Bs_ObjPersister::setPersisterID() Write back the persisterID to the objToPersist. Bs_ObjPersister::setVarSettings() Set the '_persistInfo hash'. See header for details. Bs_ObjPersister::unPersist() Unpersist the object that is handeled by this object. Bs_ObjPersister::_persistTrigger() Is triggered just befor we try to get the persist data from the object. Bs_ObjPersister::_unpersistTrigger() Is triggered just after we initialized the object successfully. #### Class: Bs_Object Bs_Object::Bs_Object() Bs_Object::getErrors() Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack. Bs_Object::getLastError() Basic error handling: Get last error string from the global Bs_Error-error stack. Bs_Object::getLastErrors() Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors(). Bs_Object::persist() Persists this object by serializing it and saving it to a file with unique name. Bs_Object::setError() Basic error handling: Push an error string on the global Bs_Error-error stack. Bs_Object::toHtml() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::toString() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::unpersist() Fetches an object that was persisted with persist()
### Class Details [line 19] dependencies: Bs_ObjPersister #### Tags:
todo: | finish this code. does not work yet, i think. or use the mysql implementation instead.
copyright: | blueshoes.org
pattern: | singleton: (pseudostatic)
access: | public
version: | 4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:17:49 $
author: | andrej arn <at blueshoes dot org>
[ Top ] ### Class Variables #### $_directory = [line 33] the directory that holds the flat files. if you think in db-lingo, $_path is the database and $_directory is the table.
Type: | string
[ Top ] #### $_path = [line 26] the path to the directory where the flat files are located. (may be a network path, right?) if you think in db-lingo, $_path is the database and $_directory is the table.
Type: | string
[ Top ] ### Class Methods ### method Bs_ObjPersisterForMySql [line 41]
`void Bs_ObjPersisterForMySql( object &$obj, [array $varSettings = NULL])`
Constuctor. #### Parameters:
object | &$obj |
array | $varSettings | (pass it by ref if possible)
[ Top ] ### method createDirectory [line 74]
`bool createDirectory( )`
Create the db table. #### Tags:
return: | true on success.
throws: | bs_exception on failure.
access: | public
[ Top ] ### method dropDirectory [line 64]
`bool dropDirectory( )`
Drop the db table (if it exists). #### Tags:
return: | true on success
throws: | bs_exception on failure. It's not a failure if the table doesn't exist.
access: | public
[ Top ] ### method getDirectory [line 54]
`void getDirectory( )`
[ Top ] ### method getPath [line 49]
`void getPath( )`
[ Top ] ### method persist [line 86]
`bool persist( )`
Persist the desired object data into the db table. if the object data is persisted for the first time, an ID is generated and written back as object var with the name 'ID'. #### Tags:
return: | true on success
throws: | bs_exception on error (db exception)
access: | public
Overrides Bs_ObjPersister::persist() (Persist the object that is handeled by this object.) [ Top ] ### method setDirectory [line 52]
`void setDirectory( )`
[ Top ] ### method setPath [line 47]
`void setPath( )`
[ Top ] ### method unPersist [line 149]
`bool unPersist( [mixed $sqlSomething = NULL])`
(Get the data from db) and push it into the object. If $sqlSomething is a recordset (hash) it will be used. If it's a string it will be used for the sql query. If not set, the $persisterID of the object is used to fetch the data. NOTE: Only the first found record set is used. #### Tags:
return: | TRUE on success, FALSE if (no valid ID available and $sqlWhere not given) or no record found.
throws: | bs_exception on a db error.
access: | public
Overrides Bs_ObjPersister::unPersist() (Unpersist the object that is handeled by this object.) #### Parameters:
mixed | $sqlSomething | can be a string (something like "WHERE field = 'value'") or a hash (recordset) directly.
[ Top ] Documentation generated on Mon, 29 Dec 2003 21:12:12 +0100 by phpDocumentor 1.2.3