Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
DALBaker Class Reference
Inheritance diagram for DALBaker:
MatrixDALBaker

Static Public Member Functions

static getSystemSchemaDocument ($systemName)
 
static addSystemSchema ($systemName)
 
static addSystemQueries ($systemName)
 
static processQueriesFile ($systemName, $fileName)
 
static mergeQuery ($systemName, $queryName)
 
static generateQueryXML ($systemName, $queryName)
 
static queryXMLExists ($systemName, $queryName)
 
static getQueryXML ($systemName, $queryName)
 
static saveQueryXML ($system, $queryName, DomDocument $doc)
 
static addQuery ($systemName, DomElement $query)
 
static addQueryFragment ($systemName, DomElement $fragment)
 
static addSubQuery ($systemName, DomElement $subQuery)
 
static bakeQueriesFile ($systemName)
 
static bakeQueryMethod ($systemName, $queryName)
 
static printSubQueries ($systemName, $queryName)
 
static getHookCodeId ($hookId)
 
static getHookArrayId ($hookId)
 
static getSeperator ($tagName)
 
static parseSchema (DomElement $schema)
 
static validateQueries (DomElement $queries)
 
static queryIdIsUnique (DomDocument $doc, DomElement $query)
 
static validateQuery (DomElement $query)
 
static getQueryType (DomElement $query)
 
static fragmentExists ($system, $queryid, $hookid)
 
static convertToSql (DomElement $xmlQuery, array $sqlArray=array())
 
static getConverter ($dbType=NULL)
 
static getTableColumnTypes ($systemid, $table, $column=NULL)
 
static getQuerySource ($systemid, $queryid)
 
static createSystemOvenPath ($system)
 
static loadQueriesXML ($systemid)
 
static getBakedQueryFileName ($systemid, $queryid)
 
static loadBakedQuery ($systemid, $queryid)
 
static loadSystemSchemaXML ($systemid)
 
static constructSql (DomElement $query)
 
static getHookPrefix ()
 
static getComparisonOperators ($type=NULL)
 
static getDatabaseType ($dsn=NULL)
 

Static Protected Member Functions

static _dbDropTable ($tableName, DALConverter $converter=NULL)
 
static _dbTableExists ($tableName, DALConverter $converter=NULL)
 
static _printAlternateAssertions (DomElement $alternate, $contents)
 
static _recurseAddAssertion (array $assertions, array $currentStack=array())
 
static _recursePrintAssertions (array $tree, DomElement $baseQuery, $baseQueryId, $level=0)
 
static _mergeAllAssertions (DomElement $baseQuery, array $assertions)
 
static _getQueryAssertions ($systemName, $queryName)
 
static _getAssertionVariableName (DomElement $assertion)
 
static _combineFragment (DomElement $query, DomElement $fragment)
 
static _prepareFragment (DomElement $query)
 
static _printAssertionCalls (array $assertions)
 
static _printAssertionInitialisation (DomElement $assertion)
 
static _printAssertionArgument (DomElement $argNode)
 
static _printNodeSql (DomElement $query, $baseId='', array $idParts=array())
 
static _writeQueryObject ($id, array $sqlArray, $sql)
 
static _printPlaceHolderVariables ($systemName, $queryName)
 
static _generateHookArray ($systemName, $queryName)
 
static _printHookCode (array $hookIds)
 
static _printKeywords ($systemName, $queryName)
 
static _printBindings ($systemName, $queryName, $printBindings=TRUE)
 
static _extractBindings (DomElement $fragment)
 
static _extractKeywords (DomElement $fragment)
 
static _extractPlaceHolders (DomElement $fragment)
 
static _getPdoDataType ($systemId, $table, $column, $dataType=NULL)
 

Detailed Description

DALbaker.

Baker class for the Database Abstraction Layer, containing methods for converting XML queries into PHP code.

Since
4.0.0

Definition at line 30 of file DALBaker.inc.

Member Function Documentation

static _combineFragment ( DomElement  $query,
DomElement  $fragment 
)
staticprotected

Integrates a fragment into the base query.

Returns a DomElement representing the new, combined query. The combining is performed by determining what elements are present in the fragment. If they are not present in the query, the whole section is added. If however the element is present in the query, then the fragment's element's child nodes are traversed and added to the query's corresponding element.

For example, if the fragment has a WHERE element, and the query doesn't, the fragment's WHERE element is copied over. If the query does have a WHERE element, then the child nodes of the fragment's WHERE element are added as children of the query's WHERE element individually.

Parameters
DomElement$queryThe base query.
DomElement$fragmentThe fragment to integrate. This should be a representation of the fragment from the opening select tag onwards.
Since
4.0.0
Returns
DomElement

Definition at line 1038 of file DALBaker.inc.

static _dbDropTable (   $tableName,
DALConverter  $converter = NULL 
)
staticprotected

Drops the given table.

Returns true if table was dropped.

Parameters
string$tableNameName of the table to drop.
DALConverter$converterDAL Converter object.
Since
4.0.0
Returns
boolean

Definition at line 209 of file DALBaker.inc.

static _dbTableExists (   $tableName,
DALConverter  $converter = NULL 
)
staticprotected

Returns true if the given table exists in the database.

Parameters
string$tableNameName of the table to drop.
DALConverter$converterDAL Converter object.
Since
4.0.0
Returns
boolean

Definition at line 235 of file DALBaker.inc.

static _extractBindings ( DomElement  $fragment)
staticprotected

Extracts the :value bindings from a fragment of a query.

The return value contains the original query, along with new binding elements attached. To find these bindings, all elements need to be searched. This is because with bindings, they can appear in many different areas of an XML query definition. To ensure all elements are only searched for fragments that actually have atleast one binding in them, the XML source of the fragment is searched using a regular expression. If there is a binding found, all elemets of the fragment are obtained, and iterated over. Elements with exactly 1 child are the only ones examined for bindings. If a binding is found, it's parent element(s) are examined to find details about the value ie. the column it applies to, the table etc. These details are added to the newly created <binding> element, and the element is appended to the <bindings> element of the fragments <query> element.

Parameters
DomElement$fragmentThe object representing the fragment to search in.
Since
4.0.0
Returns
DomElement

Definition at line 1938 of file DALBaker.inc.

static _extractKeywords ( DomElement  $fragment)
staticprotected

Extracts the keywords ([keyword]) from a fragment of a query.

Each keyword defined in the XML file as [keyword]. Where keyword can be any string with characters a-Z, A-Z and 0-9. The return value contains the original query, along with new keyword elements attached.

Parameters
DomElement$fragmentThe object representing the fragment to search in.
Since
4.0.0
Returns
string

Definition at line 2049 of file DALBaker.inc.

static _extractPlaceHolders ( DomElement  $fragment)
staticprotected

Extracts hard-coded values from a query and converts them to bindings.

Finds only hard-coded values that exist inside

tags, and creates a <placeholder> element under the parent <placeholders> element. This new element contains the value, along with a variable name that is composed by combining the table of the value and its column. This variable name is subsituted into the query in place of the original value. This allows the baked out code for the query, to bind the value to the query at run time.

Parameters
DomElement$fragmentThe object representing the fragment to search in.
Since
4.0.0
Returns
DomElement

Definition at line 2092 of file DALBaker.inc.

static _generateHookArray (   $systemName,
  $queryName 
)
staticprotected

Generates an array of data representing the sub-queries.

Parameters
string$systemNameThe system to print the sub-queries for.
string$queryNameThe query to print the sub-queries for.
Since
4.0.0
Returns
array
Exceptions
DALBakerExceptionWhen a specified hook doesn't exist.

Definition at line 1575 of file DALBaker.inc.

static _getAssertionVariableName ( DomElement  $assertion)
staticprotected

Generates a variable name that corresponds to the assertion node.

Eg. If an assertion is passed that has a channel attribute 'Users::isSystemAdmin', then '$usersIsSystemAdmin' will be returned.

If however a function call is specified in the assertion, then the variable name will be equal to the function name, and its' arguments.

It is used when baking query methods, so that assertions can be consistent and clashes or wrong references can be avoided.

Parameters
DomElement$assertionThe channel to generate the variable for.
Since
4.0.0
Returns
string
Exceptions
DALBakerExceptionIf an assetion doesn't have a funciton call.

Definition at line 721 of file DALBaker.inc.

static _getPdoDataType (   $systemId,
  $table,
  $column,
  $dataType = NULL 
)
staticprotected

Retrieves the PDO data type for a column.

Used when printing bindings for queries.

Parameters
string$systemIdSystem the column is from.
string$tableTable the column is in.
string$columnThe column name.
string$dataTypeThe datatype to bind this value with. Will override any other value.
Since
4.0.0
Returns
string

Definition at line 2208 of file DALBaker.inc.

static _getQueryAssertions (   $systemName,
  $queryName 
)
staticprotected

Returns an array of assertion objects that are in the query.

Parameters
string$systemNameThe system where the query belongs.
string$queryNameThe name of the query.
Since
4.0.0
Returns
array

Definition at line 690 of file DALBaker.inc.

static _mergeAllAssertions ( DomElement  $baseQuery,
array  $assertions 
)
staticprotected

Combines the passed assertions with the base query.

With all passed assertions, the main query is modified to add the assertion's logic.

Parameters
DomElement$baseQueryThe parts of the query that are present without any assertions.
array$assertionsAn array of DomElements representing each assertion that needs to be merged.
Since
4.0.0
Returns
DomElement

Definition at line 663 of file DALBaker.inc.

static _prepareFragment ( DomElement  $query)
staticprotected

Performs additional operations on a fragment before it is added.

Converts any hard-coded values present into Query Data Placeholders, and adds a <placeholder> element with the value as a child of the main query tag. Also calls _extractBindings() once these new QDPs are inserted which adds <binding> tags for any (query or system defined) bindings to the main query tag. The return DomElement therefore contains all of this data, and is ready to be inserted into the XML file of the channel.

Parameters
DomElement$queryThe fragment or query to prepare.
Since
4.0.0
Returns
DomElement

Definition at line 1098 of file DALBaker.inc.

static _printAlternateAssertions ( DomElement  $alternate,
  $contents 
)
staticprotected

Prints out a condition to control logic of an alternate query.

Parameters
DomElement$alternateThe object containing the alternate query and its assertions.
string$contentsThe PHP code to execute if the condition is met.
Since
4.0.0
Returns
string

Definition at line 494 of file DALBaker.inc.

static _printAssertionArgument ( DomElement  $argNode)
staticprotected

Prints out the value of an argument according to its' data type.

If a string is passed, its' value is printed with quotes, if it is an int then the quotes will be omitted etc.

Parameters
DomElement$argNodeThe argument object to print.
Since
4.0.0
Returns
string

Definition at line 1440 of file DALBaker.inc.

static _printAssertionCalls ( array  $assertions)
staticprotected

Prints out the appropriate assignments for the passed assertions.

The returned string contains PHP code that has on each line a variable that is assigned to a channel that an assertion requires.

Eg: For assert-true: $fooSomeChannel = (Foo::SomeChannel() === TRUE);

For assert-false: $fooSomeChannel = (Foo::SomeChannel() === FALSE);

For assert-null: $fooSomeChannel = (Foo::SomeChannel() === NULL);

For assert-empty: $fooSomeChannel = (empty(Foo::SomeChannel()) === TRUE);

The conditions contained in the remaining code then only need to check that an assertion's variable is identical to TRUE as if it is, then the assertion condition passed.

The code will contain code to include the appropriate files from each system that the assertions require to be evaluated.

Parameters
array$assertionsThe assertions to print calls for.
Since
4.0.0
Returns
string

Definition at line 1247 of file DALBaker.inc.

static _printAssertionInitialisation ( DomElement  $assertion)
staticprotected

Prints out the variable initialisation for the assertion passed.

Assigns the value of the assertion's channel or function call, then assigns it to a variable name generated from the assertion's contents. The returned string is in the form $variable = $method;

Parameters
DomElement$assertionThe assertion to print the initialisation for.
Since
4.0.0
Returns
string
Exceptions
DALBakerExceptionWhen the assertion contains no function call.

Definition at line 1304 of file DALBaker.inc.

static _printBindings (   $systemName,
  $queryName,
  $printBindings = TRUE 
)
staticprotected

Prints code to prepare the query and bind the placeholders to data.

This returns the code that is executed after the $sql variable is obtained from the assertion's conditions. The $dbh variable is initialised by getting the database connection from the DAL. Using the connection, the obtained $sql is prepared. All bindings are then obtained from the XML for the query. If they are a placeholder for a hard-coded value, then the placeholder is bound to the initialised variable, otherwise, the binding is done for an index into the passed $data array.

Parameters
string$systemNameThe system to print the bindings for.
string$queryNameThe query to print the bindings for.
boolean$printBindingsIf TRUE, will print bindings, otherwise will print entries into the query array.
Since
4.0.0
Returns
string

Definition at line 1844 of file DALBaker.inc.

static _printHookCode ( array  $hookIds)
staticprotected

With an array of hook data, prints out the correct PHP code.

The data provided must be in the form: array ( [$hook_id] => array ( [parent-type] => '', [sub-queries] => array ( array ( [assertion_var] => 'name_of_var', [sub-query] => DOMElement, ), ... ),

),

);

Parameters
array$hookIdsData for the hooks to print.
Since
4.0.0
Returns
string

Definition at line 1668 of file DALBaker.inc.

static _printKeywords (   $systemName,
  $queryName 
)
staticprotected

Prints code to replace keywords inside the SQL string.

Each keyword defined in the XML file as [keyword]. Where keyword is part of the channel event basket. If keyword does not exists in the event basket then sql will not be modified and most likely cause SQL error.

Parameters
string$systemNameThe system to print the bindings for.
string$queryNameThe query to print the bindings for.
Since
4.0.0
Returns
string

Definition at line 1795 of file DALBaker.inc.

static _printNodeSql ( DomElement  $query,
  $baseId = '',
array  $idParts = array() 
)
staticprotected

Returns an SQL string that corresponds to the passed DomElement.

The returned string contains a full assigment to a variables $sql. This allows the code to be inserted straight into the body of an assertion's condition body.

Parameters
DomElement$queryThe object containing the query's structure.
string$baseIdThe base ID to base the file on.
array$idPartsThe parts of the ID to make up the hash of to add to the end of the filename.
Since
4.0.0
Returns
string

Definition at line 1474 of file DALBaker.inc.

static _printPlaceHolderVariables (   $systemName,
  $queryName 
)
staticprotected

Returns PHP code for any placeholder elements that exist in the query.

The code returned contains assignments that set each variable to the hard-coded value that was defined in the original query. These variables are then bound to the query later in the generated code.

Parameters
string$systemNameThe system to print the placeholders for.
string$queryNameThe query to print the placeholders for.
Since
4.0.0
Returns
string

Definition at line 1529 of file DALBaker.inc.

static _recurseAddAssertion ( array  $assertions,
array  $currentStack = array() 
)
staticprotected

Recursively add an assertion to the tree structure.

Returns an array that contains structures for each assertion present in the $assertions array (by recursively calling itself). The array is in the form: array( 'if_condition' => array( 'current_assertion' => DomElement 'assertions' => array(), 'children' => array(), ), 'else_condition' => array( 'assertions' => array(), 'children' => array(), ), );

Parameters
array$assertionsAn array of assertions that are yet to be added to the tree structure.
array$currentStackAn array of assertions that currently apply to this branch of the tree.
Since
4.0.0
Returns
array

Definition at line 535 of file DALBaker.inc.

static _recursePrintAssertions ( array  $tree,
DomElement  $baseQuery,
  $baseQueryId,
  $level = 0 
)
staticprotected

Recursively prints out the PHP code for the tree of a query.

Prints out the conditional statements that match the assertions and fragments present in the query.

Parameters
array$treeThe tree that has been built by _recurseAddAssertion() via the calling function.
DomElement$baseQueryThe Node of the base query, containing the structure that exists regardless of assertions.
string$baseQueryIdThe base name of the query to print.
integer$levelThe level that the current assertion is at. This is used to indent the code.
Since
4.0.0
Returns
string

Definition at line 589 of file DALBaker.inc.

static _writeQueryObject (   $id,
array  $sqlArray,
  $sql 
)
staticprotected

Creates and writes out a query object.

Parameters
string$idThe object containing the query's structure.
array$sqlArrayThe array representation of the query.
string$sqlThe SQL of the query.
Since
4.0.0
Returns
string
Exceptions
DALExceptionWhen the query object being written already exists.

Definition at line 1499 of file DALBaker.inc.

static addQuery (   $systemName,
DomElement  $query 
)
static

Adds a base query definition to the query's XML file.

Extracts any hard-coded values, along with bindings and adds the data to the query object. Then saves the new data to the XML file.

Parameters
string$systemNameThe system to add the query to.
DomElement$queryThe node containing the query to add.
Since
4.0.0
Returns
boolean

Definition at line 895 of file DALBaker.inc.

static addQueryFragment (   $systemName,
DomElement  $fragment 
)
static

Adds a base query fragment definition to the query's XML file.

Extracts any hard-coded values, along with bindings and adds the data to the query object. Then saves the new data to the XML file.

Parameters
string$systemNameThe system the fragment has come from.
DomElement$fragmentThe node containing the fragment to add.
Since
4.0.0
Returns
boolean

Definition at line 940 of file DALBaker.inc.

static addSubQuery (   $systemName,
DomElement  $subQuery 
)
static

Adds a sub-query that wishes to hook into a main query.

Extracts any hard-coded values, along with bindings and adds the data to the query object. Then saves the new data to the XML file.

Parameters
string$systemNameThe system the fragment has come from.
DomElement$subQueryThe node containing the fragment to add.
Since
4.0.0
Returns
boolean

Definition at line 984 of file DALBaker.inc.

static addSystemQueries (   $systemName)
static

Adds the queries from a system to their appropriate Oven locations.

Parameters
string$systemNameThe system to add the query to.
Since
4.0.0
Returns
boolean
Exceptions
DALBakerExceptionWhen an ID isn't specifued for a query.

Definition at line 265 of file DALBaker.inc.

static addSystemSchema (   $systemName)
static

Adds and creates the schema for the supplied system.

Will find the schema.xml file from the system's directory, iterate through each of the elements it wishes to create, and will then create or update the database.

Parameters
string$systemNameThe system whose schema to add.
Since
4.0.0
Returns
boolean

Definition at line 154 of file DALBaker.inc.

static bakeQueriesFile (   $systemName)
static

Bakes out a system's queries and business logic into PHP files.

Calls bakeQueryMethod() for each query that the system has defined. For the query to be baked correctly it is required that its' XML files have been created in the system's oven directory.

Parameters
string$systemNameName of the system to bake the code for.
Since
4.0.0
Returns
void
Exceptions
DALBakerExceptionIf the system name supplied is empty.

Definition at line 1134 of file DALBaker.inc.

static bakeQueryMethod (   $systemName,
  $queryName 
)
static

Bakes out a method for a single query.

Reads in the XML files that have been generated for this query, gets all fragments and their assertions, and bakes out an appropriate method that will return an SQL statement that corresponds to the current system state and the systems currently installed.

Parameters
string$systemNameThe name of the system to which the query belongs.
string$queryNameThe name of the query to bake.
Since
4.0.0
Returns
string

Definition at line 1183 of file DALBaker.inc.

static constructSql ( DomElement  $query)
static

Constructs an SQL query from DomElement.

This is the main function where the SQL array is constructed from XML. It will combine queries from different parts of the system.

Parameters
DomElement$queryDomElement that represents a single query.
Since
4.0.0
Returns
array

Definition at line 2679 of file DALBaker.inc.

static convertToSql ( DomElement  $xmlQuery,
array  $sqlArray = array() 
)
static

Converts given XML query to its SQL format.

Parameters
DomElement$xmlQuerySingle XML query.
array$sqlArrayThe Array representation of the SQL, if it has already been generated.
Since
4.0.0
Returns
string

Definition at line 2421 of file DALBaker.inc.

static createSystemOvenPath (   $system)
static

Creates systems DAL oven directory.

Returns true on success, false if directory already exists, and throws ChannelExeption if it cannot create the directory.

Parameters
string$systemSystem name.
Since
4.0.0
Returns
boolean
Exceptions
ChannelExceptionWhen the path cannot be created.

Definition at line 2555 of file DALBaker.inc.

static fragmentExists (   $system,
  $queryid,
  $hookid 
)
static

Returns true if the fragment exists.

Parameters
string$systemId of the system.
string$queryidId of the main query.
string$hookidId of the fragment.
Since
4.0.0
Returns
boolean

Definition at line 2386 of file DALBaker.inc.

static generateQueryXML (   $systemName,
  $queryName 
)
static

Generates a base file for adding XML data for the query specified.

Parameters
string$systemNameThe name of the system the query is from.
string$queryNameThe name of the query to create the XML file for.
Since
4.0.0
Returns
boolean

Definition at line 786 of file DALBaker.inc.

static getBakedQueryFileName (   $systemid,
  $queryid 
)
static

Returns the file name of the baked query file.

Parameters
string$systemidId of the system.
string$queryidId of the query.
Since
4.0.0
Returns
string

Definition at line 2606 of file DALBaker.inc.

static getComparisonOperators (   $type = NULL)
static

Returns list of allowed where clause conditions.

Parameters
string$typeType of the condition. It will return its sign.
Since
4.0.0
Returns
array

Definition at line 2719 of file DALBaker.inc.

static getConverter (   $dbType = NULL)
static

Returns the DAL converter class for a given db type.

If no dbType is given then the db type specified in DALConf will be used.

Parameters
string$dbTypeDatabase Type.
Since
4.0.0
Returns
object

Definition at line 2443 of file DALBaker.inc.

static getDatabaseType (   $dsn = NULL)
static

Parses the connection string and returns the database type.

Parameters
array$dsnThe DSN array to parse. If NULL, the DSN setting of the current connection will be used.
Since
4.0.0
Returns
string

Definition at line 2743 of file DALBaker.inc.

static getHookArrayId (   $hookId)
static

Returns a string like $hook_iddArray corresponding to the hook id passed.

This ID is used for the variable name of the array storing all fragments that wish to reference the hook.

Parameters
string$hookIdThe hook id to retrieve the array ID for.
Since
4.0.0
Returns
string

Definition at line 1743 of file DALBaker.inc.

static getHookCodeId (   $hookId)
static

Returns a string like HOOKID:hook_id corresponding to the hook id passed.

This ID is used for replacements in PHP code.

Parameters
string$hookIdThe hook id to retireve the code ID for.
Since
4.0.0
Returns
string

Definition at line 1725 of file DALBaker.inc.

static getHookPrefix ( )
static

Returns a prefix for the hooks.

Baker will later on look for this prefix in SQL query string and replace them with other SQL queries.

Since
4.0.0
Returns
string

Definition at line 2703 of file DALBaker.inc.

static getQuerySource (   $systemid,
  $queryid 
)
static

Returns query in its XML format.

DomElement of the query in queries.xml file is returned. Null if query was not found.

Parameters
string$systemidSystem name that the query belongs to.
string$queryidId of the query.
Since
4.0.0
Returns
object

Definition at line 2524 of file DALBaker.inc.

static getQueryType ( DomElement  $query)
static

Returns the given queries type.

Parameters
DomElement$queryThe query element.
Since
4.0.0
Returns
string

Definition at line 2363 of file DALBaker.inc.

static getQueryXML (   $systemName,
  $queryName 
)
static

Retrieve the object representing the query's XML file.

Parameters
string$systemNameThe name of the system the query is in.
string$queryNameThe name of the query to retrieve the XML file for.
Since
4.0.0
Returns
DomDocument

Definition at line 837 of file DALBaker.inc.

static getSeperator (   $tagName)
static

Gets the text for a seperator from the tag type passed.

Parameters
string$tagNameThe tag name to get the seperator for.
Since
4.0.0
Returns
string

Definition at line 1759 of file DALBaker.inc.

static getSystemSchemaDocument (   $systemName)
static

Returns the DomDocument for the schema.xml of the specfied system.

Returns null if the system does not contain a system.xml file.

Parameters
string$systemNameThe name of the system to retrieve the schema for.
Since
4.0.0
Returns
DomDocument The schema document.

Definition at line 125 of file DALBaker.inc.

static getTableColumnTypes (   $systemid,
  $table,
  $column = NULL 
)
static

Gets the column types of a specific table in a system.

If column argument is NULL then array of all column types will be returned. If column argument is not NULL then a single type will be returned. Returns NULL if table/column not found.

Parameters
string$systemidId of the system.
string$tableName of the table.
string$columnName of a single column.
Since
4.0.0
Returns
(array|string)

Definition at line 2474 of file DALBaker.inc.

static loadBakedQuery (   $systemid,
  $queryid 
)
static

Returns the DomElement of the baked query file.

Parameters
string$systemidId of the system.
string$queryidId of the query.
Since
4.0.0
Returns
object

Definition at line 2623 of file DALBaker.inc.

static loadQueriesXML (   $systemid)
static

Returns the DomDocument object for the system's queries XML.

Returns NULL if queries.xml cannot be loaded.

Parameters
string$systemidSystem name.
Since
4.0.0
Returns
object

Definition at line 2582 of file DALBaker.inc.

static loadSystemSchemaXML (   $systemid)
static

Loads the System's schema XML file.

Returns NULL if schema file could not be loaded.

Parameters
string$systemidId of the system.
Since
4.0.0
Returns
object

Definition at line 2648 of file DALBaker.inc.

static mergeQuery (   $systemName,
  $queryName 
)
static

Merges the base query and all of its' fragments.

Returns a string containing the PHP code for the query, and any possible combinations of queries with the assertions present.

Parameters
string$systemNameThe system to which the query belongs.
string$queryNameThe name of the query to generate.
Since
4.0.0
Returns
string
Exceptions
DALBakerExceptionWhen there is no primary query found.

Definition at line 366 of file DALBaker.inc.

static parseSchema ( DomElement  $schema)
static

Converts XML schema to php array.

Parameters
DomElement$schemaSchema node of a schema.
Since
4.0.0
Returns
array

Definition at line 2244 of file DALBaker.inc.

static printSubQueries (   $systemName,
  $queryName 
)
static

Prints out the data for searching and replacing sub-queries.

Parameters
string$systemNameThe system to print the sub-queries for.
string$queryNameThe query to print the sub-queries for.
Since
4.0.0
Returns
string

Definition at line 1557 of file DALBaker.inc.

static processQueriesFile (   $systemName,
  $fileName 
)
static

Processes a queries.xml file to prepare it for baking

Parameters
string$systemNameThe system to add queries to.
string$fileNameThe name of the queries file.
Since
4.0.0
Returns
void
Exceptions
DALBakerExceptionWhen an ID isn't specified for a query.

Definition at line 293 of file DALBaker.inc.

static queryIdIsUnique ( DomDocument  $doc,
DomElement  $query 
)
static

Returns FALSE if given query id already used by another query.

Parameters
DomDocument$docDomDocument object.
DomElement$queryQuery element.
Since
4.0.0
Returns
boolean

Definition at line 2301 of file DALBaker.inc.

static queryXMLExists (   $systemName,
  $queryName 
)
static

Returns TRUE if the XML file for a system exists.

Parameters
string$systemNameThe name of the system to check for.
string$queryNameThe name of the query to check the XML file for.
Since
4.0.0
Returns
boolean

Definition at line 817 of file DALBaker.inc.

static saveQueryXML (   $system,
  $queryName,
DomDocument  $doc 
)
static

Save the passed representation of the query.

Parameters
string$systemThe name of the system the query is in.
string$queryNameThe name of the query to save.
DomDocument$docThe Object representing the new XML contents.
Since
4.0.0
Returns
DomDocument

Definition at line 864 of file DALBaker.inc.

static validateQueries ( DomElement  $queries)
static

Validates all the queries under the given queries node.

Throws DALParserException if any errors found.

Parameters
DomElement$queriesThe queries node of the queries XML file.
Since
4.0.0
Returns
void
Exceptions
DALParserExceptionWhen a query tag doesn't have a system attribute.

Definition at line 2270 of file DALBaker.inc.

static validateQuery ( DomElement  $query)
static

Validates the given query.

Throws DALParserException if any errors found.

Parameters
DomElement$queryThe query element.
Since
4.0.0
Returns
void
Exceptions
DALParserExceptionWhen a query is missing an ID, its' ID is not unique, or the query is invalidly formatted.

Definition at line 2331 of file DALBaker.inc.


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