Source for file tables.php
Documentation is available at tables.php
* @package FrameworkOnFramework
* @copyright Copyright (c)2010-2012 Nicholas K. Dionysopoulos
* @license GNU General Public License version 2, or later
* Configuration parser for the tables-specific settings
* @package FrameworkOnFramework
* Parse the XML data, adding them to the $ret array
* @param SimpleXMLElement $xml The XML data of the component's configuration area
* @param array &$ret The parsed data, in the form of a hash array
public function parseDomain(SimpleXMLElement $xml, array &$ret)
$ret['tables'] =
array();
// Parse table configuration
$tableData =
$xml->xpath('table');
foreach ($tableData as $aTable)
$key = (string)
$aTable['name'];
$ret['tables'][$key]['behaviors'] = (string)
$aTable->behaviors;
$ret['tables'][$key]['tablealias'] =
$aTable->xpath('tablealias');
$ret['tables'][$key]['fields'] =
array();
$fieldData =
$aTable->xpath('field');
foreach ($fieldData as $field)
$k = (string)
$field['name'];
$ret['tables'][$key]['fields'][$k] = (string)
$field;
* Return a configuration variable
* @param string &$configuration Configuration variables (hashed array)
* @param string $var The variable we want to fetch
* @param mixed $default Default value
* @return mixed The variable's value
public function get(&$configuration, $var, $default)
$method =
'get' .
ucfirst($parts[1]);
$ret =
$this->$method($view, $configuration, $parts, $default);
* Internal method to return the magic field mapping
* @param string $table The table for which we will be fetching a field map
* @param array &$configuration The configuration parameters hash array
* @param array $params Extra options; key 0 defines the table we want to fetch
* @param string $default Default magic field mapping; empty if not defined
* @return array Field map
protected function getField($table, &$configuration, $params, $default =
'')
if (isset
($configuration['tables']['*']) && isset
($configuration['tables']['*']['fields']))
$fieldmap =
$configuration['tables']['*']['fields'];
if (isset
($configuration['tables'][$table]) && isset
($configuration['tables'][$table]['fields']))
$fieldmap =
array_merge($fieldmap, $configuration['tables'][$table]['fields']);
elseif (isset
($fieldmap[$params[0]]))
$map =
$fieldmap[$params[0]];
* Internal method to get table alias
* @param string $table The table for which we will be fetching table alias
* @param array &$configuration The configuration parameters hash array
* @param array $params Extra options; key 0 defines the table we want to fetch
* @param string $default Default table alias
* @return string Table alias
protected function getTablealias($table, &$configuration, $params, $default =
'')
if (isset
($configuration['tables']['*'])
&& isset
($configuration['tables']['*']['tablealias'])
&& isset
($configuration['tables']['*']['tablealias'][0]))
$tablealias = (string)
$configuration['tables']['*']['tablealias'][0];
if (isset
($configuration['tables'][$table])
&& isset
($configuration['tables'][$table]['tablealias'])
&& isset
($configuration['tables'][$table]['tablealias'][0]))
$tablealias = (string)
$configuration['tables'][$table]['tablealias'][0];
* Internal method to get table alias
* @param string $table The table for which we will be fetching table alias
* @param array &$configuration The configuration parameters hash array
* @param array $params Extra options; key 0 defines the table we want to fetch
* @param string $default Default table alias
* @return string Table alias
protected function getBehaviors($table, &$configuration, $params, $default =
'')
if (isset
($configuration['tables']['*'])
&& isset
($configuration['tables']['*']['behaviors'])
&& isset
($configuration['tables']['*']['behaviors']))
$behaviors = (string)
$configuration['tables']['*']['behaviors'];
if (isset
($configuration['tables'][$table])
&& isset
($configuration['tables'][$table]['behaviors'])
&& isset
($configuration['tables'][$table]['behaviors']))
$behaviors = (string)
$configuration['tables'][$table]['behaviors'];
Documentation generated on Tue, 19 Nov 2013 15:15:03 +0100 by phpDocumentor 1.4.3