wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
StringQuery Class Reference

Public Member Functions

 execute ($type, $queryString, $buildDepth, $orderby=null, &$pagingInfo, $attribs=null)
 
 toString ($buildDepth=BUILDDEPTH_SINGLE, $attribs=null)
 
 buildQuery ($buildDepth, $attribs=null)
 
 mapToDatabase ($type, $valueName)
 

Public Attributes

 $_typeNode = null
 
 $_queryString = ''
 
 $_query = ''
 

Detailed Description

StringQuery executes queries from a string representation. Queries are constructed like WHERE clauses in sql, except that foreign key relations between the different types are not necessary. Attributes have to be defined with the appropriate type prepended, e.g. Author.name instead of name.

wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id:
class.StringQuery.php 1462 2014-02-04 23:52:27Z iherwig

The following example shows the usage:

$queryStr = "Author.name LIKE '%ingo%' AND (Recipe.name LIKE '%Salat%' OR Recipe.portions = 4)";
$authorOIDs = $query->execute('Author', $queryStr, false);
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 44 of file class.StringQuery.php.

Member Function Documentation

StringQuery::execute (   $type,
  $queryString,
  $buildDepth,
  $orderby = null,
$pagingInfo,
  $attribs = null 
)

Execute the query

Parameters
typeThe type to search for.
queryStringThe query definition string
buildDepthOne of the BUILDDEPTH constants or a number describing the number of generations to load (except BUILDDEPTH_REQUIRED) or false if only oids should be returned
orderbyAn array holding names of attributes to ORDER by (maybe null). [default: null]
pagingInfoA reference paging info instance (maybe null). [default: null]
attribsAn array of attributes to load (null to load all, if buildDepth != false). [default: null]
Returns
A list of objects that match the given conditions or a list of oids

Definition at line 61 of file class.StringQuery.php.

References BUILDDEPTH_SINGLE, buildQuery(), ObjectQuery\executeString(), PersistenceFacade\getInstance(), ObjectQuery\getMapper(), PersistenceFacade\isKnownType(), and WCMFException\throwEx().

+ Here is the call graph for this function:

StringQuery::toString (   $buildDepth = BUILDDEPTH_SINGLE,
  $attribs = null 
)

Get the used query

Note
The query must be executed once to get a result
Parameters
buildDepth
See Also
StringQuery::execute() [default: BUILDDEPTH_SINGLE]
Parameters
attribsAn array of attributes to load (null to load all, if buildDepth != false). [default: null]
Returns
The sql query string

Definition at line 89 of file class.StringQuery.php.

References buildQuery(), Message\get(), and WCMFException\throwEx().

+ Here is the call graph for this function:

StringQuery::buildQuery (   $buildDepth,
  $attribs = null 
)

Build the query

Parameters
buildDepth
See Also
StringQuery::execute()
Parameters
attribsAn array of attributes to load (null to load all, if buildDepth != false). [default: null]
Returns
The sql query string

Definition at line 102 of file class.StringQuery.php.

References $_queryString, NodeUtil\getConnectionToAncestor(), NodeUtil\getConnectionToDescendant(), ObjectQuery\getMapper(), ObjectQuery\getRelationCondition(), ObjectQuery\getTableName(), PersistenceFacade\isKnownType(), mapToDatabase(), StringUtil\splitQuoted(), and WCMFException\throwEx().

Referenced by execute(), and toString().

+ Here is the call graph for this function:

StringQuery::mapToDatabase (   $type,
  $valueName 
)

Map a application type and value name to the appropriate database names

Parameters
typeThe type to map
valueNameThe name of the value to map
Returns
An array with the table and column name or null if no mapper is found

Definition at line 230 of file class.StringQuery.php.

References BUILDDEPTH_SINGLE, PersistenceFacade\getInstance(), and ObjectQuery\getMapper().

Referenced by buildQuery().

+ Here is the call graph for this function:

Member Data Documentation

StringQuery::$_typeNode = null

Definition at line 46 of file class.StringQuery.php.

StringQuery::$_queryString = ''

Definition at line 47 of file class.StringQuery.php.

Referenced by buildQuery().

StringQuery::$_query = ''

Definition at line 48 of file class.StringQuery.php.


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