Detailed Description
StringQuery executes queries from a string representation.
Queries are constructed in two possible ways:
- Like WHERE clauses in SQL
- As RQL queries (https://github.com/persvr/rql)
Note the following rules:
- Foreign key relations between different types do not need to be included in the query string.
- Attributes have to be prepended with the type name (or in case of ambiguity the role name), e.g. Author.name instead of name.
- Note
- : The query does not search in objects, that are created inside the current transaction.
The following example shows the usage:
Definition at line 53 of file StringQuery.php.
Inheritance diagram for StringQuery:Public Member Functions | |
| getConditionString () | |
| setConditionString ($condition) | |
| setRQLConditionString ($condition) | |
Public Member Functions inherited from ObjectQuery | |
| __construct ($type, $queryId=SelectStatement::NO_CACHE) | |
| __destruct () | |
| getId () | |
| getObjectTemplate ($type, $alias=null, $combineOperator=Criteria::OPERATOR_AND) | |
| registerObjectTemplate (Node $template, $alias=null, $combineOperator=Criteria::OPERATOR_AND) | |
| makeGroup ($templates, $combineOperator=Criteria::OPERATOR_AND) | |
| getQueryCondition () | |
| getQueryType () | |
| valueChanged (ValueChangeEvent $event) | |
Public Member Functions inherited from AbstractQuery | |
| execute ($buildDepth, $orderby=null, $pagingInfo=null) | |
| getQueryString ($buildDepth=BuildDepth::SINGLE, $orderby=null) | |
| getLastQueryString () | |
Protected Member Functions | |
| buildQuery ($buildDepth, $orderby=null, PagingInfo $pagingInfo=null) | |
| parseRQL ($query) | |
Protected Member Functions inherited from ObjectQuery | |
| getLogger () | |
| processObjectTemplate (PersistentObject $tpl, SelectStatement $selectStmt) | |
| processOrderBy ($orderby, SelectStatement $selectStmt) | |
| getParameters ($criteria, array $parameters) | |
| getParameterPosition ($criterion, $criteria) | |
| resetInternals () | |
| processTableName (Node $tpl) | |
Protected Member Functions inherited from AbstractQuery | |
| executeInternal (SelectStatement $selectStmt, $buildDepth, PagingInfo $pagingInfo=null) | |
Static Protected Member Functions | |
| static | mapToDatabase ($type, $valueName) |
Static Protected Member Functions inherited from AbstractQuery | |
| static | getConnection ($type) |
| static | getMapper ($type) |
Additional Inherited Members | |
Public Attributes inherited from ObjectQuery | |
| const | PROPERTY_COMBINE_OPERATOR = "object_query_combine_operator" |
| const | PROPERTY_TABLE_NAME = "object_query_table_name" |
| const | PROPERTY_INITIAL_OID = "object_query_initial_oid" |
Member Function Documentation
◆ getConditionString()
| getConditionString | ( | ) |
◆ setConditionString()
| setConditionString | ( | $condition | ) |
Set the query condition string.
- Parameters
-
$condition The query definition string
Definition at line 69 of file StringQuery.php.
◆ setRQLConditionString()
| setRQLConditionString | ( | $condition | ) |
Set the query condition string as RQL.
- Parameters
-
$condition The query definition string
Definition at line 77 of file StringQuery.php.
◆ buildQuery()
|
protected |
- See also
- AbstractQuery::buildQuery()
Reimplemented from ObjectQuery.
Definition at line 84 of file StringQuery.php.
◆ parseRQL()
|
protected |
Parse the given query encoded in RQL (https://github.com/persvr/rql), e.g.
(Profile.keyword1=in=8,1|Profile.keyword2=in=8,2|Profile.keywords3=in=8,3)&Profile.yearlySalary=gte=1000
- Parameters
-
$query RQL query string
- Returns
- String
Definition at line 204 of file StringQuery.php.
◆ mapToDatabase()
|
staticprotected |
Map a application type and value name to the appropriate database names.
- Parameters
-
$type The type to map $valueName The 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 273 of file StringQuery.php.