wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
NodeXMLDBMapper Class Reference
+ Inheritance diagram for NodeXMLDBMapper:

Public Member Functions

 NodeXMLDBMapper ($params)
 
 setFilename ($params)
 
 getPkNames ()
 
loadImpl ($oid, $buildDepth, $buildAttribs=null, $buildTypes=null)
 
createImpl ($type, $buildDepth, $buildAttribs)
 
 saveImpl (&$node)
 
 deleteImpl ($oid, $recursive=true)
 
 getOIDs ($type, $criteria=null, $orderby=null, &$pagingInfo)
 
 loadObjects ($type, $buildDepth, $criteria=null, $orderby=null, &$pagingInfo, $buildAttribs=null, $buildTypes=null)
 
 getOrderBy ()
 
 startReadTransaction ()
 
 startTransaction ()
 
 commitTransaction ()
 
 rollbackTransaction ()
 
 openDatabase ($lock=true)
 
 closeDatabase ()
 
createObject ($type, $oid=null)
 
 getNodeDefinition ($type)
 
- Public Member Functions inherited from PersistenceMapper
 getType ()
 
 getPkNames ()
 
 setDataConverter ($dataConverter)
 
 getDataConverter ()
 
 enableLogging ($logStrategy)
 
 disableLogging ()
 
 isLogging ()
 
 logAction (&$obj)
 
load ($oid, $buildDepth, $buildAttribs=null, $buildTypes=null)
 
create ($type, $buildDepth, $buildAttribs=null)
 
 save (&$object)
 
 delete ($oid, $recursive=true)
 
 checkAuthorization ($oid, $action)
 
 authorizationFailedError ($oid, $action)
 
 initialize (&$object)
 
 isValidOID ($oid)
 
loadImpl ($oid, $buildDepth, $buildAttribs=null, $buildTypes=null)
 
createImpl ($type, $buildDepth, $buildAttribs=null)
 
 saveImpl (&$object)
 
 deleteImpl ($oid, $recursive=true)
 
 getOIDs ($type, $criteria=null, $orderby=null, &$pagingInfo)
 
 loadObjects ($type, $buildDepth, $criteria=null, $orderby=null, &$pagingInfo, $buildAttribs=null, $buildTypes=null)
 
 getOrderBy ()
 
 startTransaction ()
 
 commitTransaction ()
 
 rollbackTransaction ()
 

Public Attributes

 $_filename = ''
 
 $_doctype = ''
 
 $_dtd = ''
 
 $_db = null
 
 $_inTransaction = false
 
- Public Attributes inherited from PersistenceMapper
 $_dataConverter = null
 
 $_type = ''
 
 $_logging = false
 
 $_logStrategy = null
 

Detailed Description

NodeXMLDBMapper maps Node objects to a xml file using the CXmlDb class. http://sourceforge.net/projects/phpxmldb.

Todo:

insert doctype, dtd into XML file

when inserting children to a Node with text content the content is duplicated

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

Definition at line 53 of file class.NodeXMLDBMapper.php.

Member Function Documentation

NodeXMLDBMapper::NodeXMLDBMapper (   $params)

Constructor.

Parameters
paramsInitialization data given in an assoziative array with the following keys: filename, doctype, dtd

Definition at line 69 of file class.NodeXMLDBMapper.php.

References WCMFException\throwEx().

+ Here is the call graph for this function:

NodeXMLDBMapper::setFilename (   $params)

Set the data file. Ends the transaction on the existing file.

Parameters
paramsInitialization data given in an assoziative array with the following keys: filename, doctype, dtd

Definition at line 107 of file class.NodeXMLDBMapper.php.

References commitTransaction(), and WCMFException\throwEx().

+ Here is the call graph for this function:

NodeXMLDBMapper::getPkNames ( )
See Also
PersistenceMapper::getPkNames()

Definition at line 127 of file class.NodeXMLDBMapper.php.

References DATATYPE_IGNORE.

& NodeXMLDBMapper::loadImpl (   $oid,
  $buildDepth,
  $buildAttribs = null,
  $buildTypes = null 
)
& NodeXMLDBMapper::createImpl (   $type,
  $buildDepth,
  $buildAttribs 
)
NodeXMLDBMapper::saveImpl ( $node)
NodeXMLDBMapper::getOIDs (   $type,
  $criteria = null,
  $orderby = null,
$pagingInfo 
)
See Also
PersistenceMapper::getOIDs()
Note
The orderby, pagingInfo parameters are not supported by this mapper.

Definition at line 418 of file class.NodeXMLDBMapper.php.

References startReadTransaction().

+ Here is the call graph for this function:

NodeXMLDBMapper::loadObjects (   $type,
  $buildDepth,
  $criteria = null,
  $orderby = null,
$pagingInfo,
  $buildAttribs = null,
  $buildTypes = null 
)
See Also
PersistenceFacade::loadObjects()

Definition at line 444 of file class.NodeXMLDBMapper.php.

References WCMFException\throwEx().

+ Here is the call graph for this function:

NodeXMLDBMapper::getOrderBy ( )
See Also
PersistenceMapper::getOrderBy()

Definition at line 451 of file class.NodeXMLDBMapper.php.

References WCMFException\throwEx().

+ Here is the call graph for this function:

NodeXMLDBMapper::startReadTransaction ( )

Start a non blocking read transaction

Definition at line 458 of file class.NodeXMLDBMapper.php.

References Log\debug(), and openDatabase().

Referenced by getOIDs(), and loadImpl().

+ Here is the call graph for this function:

NodeXMLDBMapper::startTransaction ( )
See Also
PersistenceMapper::startTransaction() From now on all calls to save() and delete() will be executed to a temporary tree that will be saved by the call to commitTransaction().

Definition at line 468 of file class.NodeXMLDBMapper.php.

References Log\debug(), and openDatabase().

Referenced by deleteImpl(), and saveImpl().

+ Here is the call graph for this function:

NodeXMLDBMapper::commitTransaction ( )
See Also
PersistenceMapper::commitTransaction() Save the temporary tree.

Definition at line 481 of file class.NodeXMLDBMapper.php.

References closeDatabase(), and Log\debug().

Referenced by setFilename().

+ Here is the call graph for this function:

NodeXMLDBMapper::rollbackTransaction ( )
See Also
PersistenceMapper::rollbackTransaction() Nothing to do since the changes have to be explicitely committed.

Definition at line 494 of file class.NodeXMLDBMapper.php.

NodeXMLDBMapper::openDatabase (   $lock = true)

Open the XML database

Parameters
lockTrue/False wether a lock is required or not

Definition at line 501 of file class.NodeXMLDBMapper.php.

References Log\debug(), and WCMFException\throwEx().

Referenced by startReadTransaction(), and startTransaction().

+ Here is the call graph for this function:

NodeXMLDBMapper::closeDatabase ( )

Close the XML database

Definition at line 519 of file class.NodeXMLDBMapper.php.

References Log\debug().

Referenced by commitTransaction().

+ Here is the call graph for this function:

& NodeXMLDBMapper::createObject (   $type,
  $oid = null 
)

TEMPLATE METHODS Subclasses will override these to define their Node type. Factory method for the supported object type.

Note
Subclasses must implement this method to define their object type.
Parameters
typeThe type of object to create
oidThe object id (maybe null)
Returns
A reference to the created object.

Definition at line 537 of file class.NodeXMLDBMapper.php.

References WCMFException\throwEx().

Referenced by createImpl(), and loadImpl().

+ Here is the call graph for this function:

NodeXMLDBMapper::getNodeDefinition (   $type)

Get the Node type definition.

Note
Subclasses will override this to define their Node type.
Parameters
typeThe type of the Node
Returns
An assoziative array with unchangeable keys '_properties', '_datadef', '_children', '_data'. The keys itself hold the following structures:
  • _properties: An array of assoziative arrays with the keys 'name', 'value' for every property (e.g. array('visible' => 1))
  • _datadef: An array of assoziative arrays with the keys 'name', 'app_data_type', 'db_data_type', 'default' plus application specific keys for every data item. All keys except 'name' and 'app_data_type' will become keys in the Nodes valueProperties array hold for each data item. (e.g. array('name' => 'title', 'db_data_type' => 'data_txt', 'app_data_type' => DATATYPE_ATTRIBUTE, 'default' => 'Hello World!'))
    Known attributes are:
    • default: The default value (will be set when creating a blank Node, see PersistenceMapper::create())
    • restrictions_match: A regular expression that the value must match (e.g. '[0-3][0-9].[0-1][0-9].[0-9][0-9][0-9][0-9]' for date values)
    • restrictions_not_match: A regular expression that the value must NOT match
    • is_editable: true, false whether the value should be editable, see FormUtil::getInputControl()
    • input_type: The HTML input type for the value, see FormUtil::getInputControl()
  • _children: An array of assoziative arrays with the keys 'type', 'minOccurs', 'maxOccurs', 'aggregation', 'composition' for every child (e.g. array('type' => 'textblock', 'minOccurs' => 0, 'maxOccurs' => 'unbounded', 'aggregation' => true, 'composition' => false))
  • _data: An assoziative array where the keys are the data item names defined in the _datadef array (e.g. array('title' => 'Hello User!'))
    Note
    The _data array will be overridden with data provided by the db select. No need for definition at this point!

Definition at line 565 of file class.NodeXMLDBMapper.php.

Referenced by createImpl(), and loadImpl().

Member Data Documentation

NodeXMLDBMapper::$_filename = ''

Definition at line 56 of file class.NodeXMLDBMapper.php.

NodeXMLDBMapper::$_doctype = ''

Definition at line 57 of file class.NodeXMLDBMapper.php.

NodeXMLDBMapper::$_dtd = ''

Definition at line 58 of file class.NodeXMLDBMapper.php.

NodeXMLDBMapper::$_db = null

Definition at line 60 of file class.NodeXMLDBMapper.php.

NodeXMLDBMapper::$_inTransaction = false

Definition at line 62 of file class.NodeXMLDBMapper.php.


The documentation for this class was generated from the following file: