PHP Class Doctrine\OrientDB\Query\Query

Inheritance: implements Doctrine\OrientDB\Query\QueryInterface
Show file Open project: doctrine/orientdb-odm Class Usage Examples

Protected Properties

Property Type Description
$command
$commands

Public Methods

Method Description
__construct ( array $target = [], array $commands = [] ) Builds a query with the given $command on the given $target.
__toString ( ) Returns the raw SQL statement
add ( array $updates, string $class, boolean $append = true ) : Add Adds a relation in a link-list|set.
alter ( string $class, string $attribute, string $value ) : Alter Alters an attribute of a class.
alterProperty ( string $class, string $property, string $attribute, string $value ) : Alter Alters the $property of $class setting $sttribute to $value.
andWhere ( string $condition, mixed $value = null ) Adds a where condition to the query.
between ( string $key, string $left, string $right ) Converts a "normal" select into an index one.
canHydrate ( ) : boolean Checks whether the current query returns records that can be hydrated
create ( string $class, string $property = null, string $type = null, string $linked = null ) : mixed Executes a CREATE of a $class, or of the $property in the given $class if $property is specified.
delete ( string $from ) : Delete Executes a DELETE SQL query on the given class (= $from).
drop ( string $class, string $property = null ) : mixed Drops a $class, or the $property in the given $class if $property is specified.
fields ( array $fields, boolean $append = true ) : Query Sets the fields to query.
findReferences ( string $rid, array $classes = [], boolean $append = true ) : Find Finds documents referencing the document with the given $rid.
from ( array $target, boolean $append = true ) Adds a from clause to the query.
getCommand ( ) : Command Returns the internal command.
getRaw ( ) : String Returns the raw SQL query statement.
getTokens ( ) : array Returns the tokens associated to the current query.
grant ( string $permission ) : Grant Converts the query into an GRANT with the given $permission.
in ( array $in, boolean $append = true ) : mixed Sets the classes in which the query performs is operation.
index ( string $property, string $type, string $class = null ) : Query Creates a index
indexCount ( string $indexName ) Count the elements of the index $indexName.
indexPut ( string $indexName, string $key, string $rid ) Puts a new entry in the index $indexName with the given $key and $rid.
indexRemove ( string $indexName, string $key, string $rid = null ) Removes the index $indexName with the given $key/$rid.
insert ( ) : Query Converts the query into an INSERT.
into ( string $target ) : Query Inserts the INTO clause to a query.
limit ( $limit ) Adds a limit to the current query.
link ( string $class, string $property, string $alias, boolean $inverse = false ) : Link Sets the internal command to a LINK, which is capable to create a reference from the $property of $class, with a given $alias.
lookup ( $indexName )
on ( string $on ) : Query Sets the ON clause of a query.
orWhere ( string $condition, mixed $value = null ) Adds an OR clause to the query.
orderBy ( array $order, boolean $append = true, boolean $first = false ) Orders the query.
put ( array $values, string $class, $append = true ) : Command Changes the internal command to an PUT, setting the class to update and the values to be written.
rebuild ( string $indexName ) Rebuild the index $indexName
remove ( array $updates, string $class, boolean $append = true ) : Remove Removes a link from a link-set|list.
resetWhere ( ) Resets the WHERE conditions.
revoke ( string $permission ) : Revoke Converts the query into an REVOKE with the given $permission.
select ( array $projections, boolean $append = true ) Adds an array of fields into the select part of the query.
skip ( $records ) Adds a skip clause to the current query.
to ( string $to ) : Query Adds a subject to the query.
truncate ( string $entity, boolean $andCluster = false ) : Query Truncates an entity.
type ( string $type ) : Query Sets the type clause of a query.
unindex ( string $property, string $class = null ) : Query Removes a index
update ( string $class ) : Command Changes the internal command to an UPDATE, setting the class to update.
values ( array $values, boolean $append = true ) : Insert Sets the values to be inserted into the current query.
where ( string $condition, mixed $value = null ) Adds the WHERE clause.

Protected Methods

Method Description
executeClassOrPropertyCommand ( string $action, string $class, string $property = null, string $type = null, string $linked = null ) : mixed Executes a class or property command checking if the $property parameter is specified.
getCommandClass ( string $id ) : mixed Returns on of the commands that belong to the query.
manageClass ( string $action, string $class ) Sets the right class command based on the $action.
manageProperty ( string $action, string $class, string $property, $type = null, $linked = null ) Sets the right property command based on the $action.
setCommands ( array $commands ) : true Sets the internal command classes to use

Method Details

__construct() public method

Builds a query with the given $command on the given $target.
public __construct ( array $target = [], array $commands = [] )
$target array
$commands array

__toString() public method

Returns the raw SQL statement
public __toString ( )

add() public method

Adds a relation in a link-list|set.
public add ( array $updates, string $class, boolean $append = true ) : Add
$updates array
$class string
$append boolean
return Add

alter() public method

Alters an attribute of a class.
public alter ( string $class, string $attribute, string $value ) : Alter
$class string
$attribute string
$value string
return Alter

alterProperty() public method

Alters the $property of $class setting $sttribute to $value.
public alterProperty ( string $class, string $property, string $attribute, string $value ) : Alter
$class string
$property string
$attribute string
$value string
return Alter

andWhere() public method

Adds a where condition to the query.
public andWhere ( string $condition, mixed $value = null )
$condition string
$value mixed

between() public method

You use do a select on an index you can use the between operator.
public between ( string $key, string $left, string $right )
$key string
$left string
$right string

canHydrate() public method

Checks whether the current query returns records that can be hydrated
public canHydrate ( ) : boolean
return boolean

create() public method

Executes a CREATE of a $class, or of the $property in the given $class if $property is specified.
public create ( string $class, string $property = null, string $type = null, string $linked = null ) : mixed
$class string
$property string
$type string
$linked string
return mixed

delete() public method

Executes a DELETE SQL query on the given class (= $from).
public delete ( string $from ) : Delete
$from string
return Delete

drop() public method

Drops a $class, or the $property in the given $class if $property is specified.
public drop ( string $class, string $property = null ) : mixed
$class string
$property string
return mixed

executeClassOrPropertyCommand() protected method

If none, class command is executed.
protected executeClassOrPropertyCommand ( string $action, string $class, string $property = null, string $type = null, string $linked = null ) : mixed
$action string
$class string
$property string
$type string
$linked string
return mixed

fields() public method

Sets the fields to query.
public fields ( array $fields, boolean $append = true ) : Query
$fields array
$append boolean
return Query

findReferences() public method

You can specify to look for only certain $classes, that can be appended.
public findReferences ( string $rid, array $classes = [], boolean $append = true ) : Find
$rid string
$classes array
$append boolean
return Find

from() public method

Adds a from clause to the query.
public from ( array $target, boolean $append = true )
$target array
$append boolean

getCommand() public method

Returns the internal command.
public getCommand ( ) : Command
return Command

getCommandClass() protected method

Returns on of the commands that belong to the query.
protected getCommandClass ( string $id ) : mixed
$id string
return mixed

getRaw() public method

Returns the raw SQL query statement.
public getRaw ( ) : String
return String

getTokens() public method

Returns the tokens associated to the current query.
public getTokens ( ) : array
return array

grant() public method

Converts the query into an GRANT with the given $permission.
public grant ( string $permission ) : Grant
$permission string
return Doctrine\OrientDB\Query\Command\Credential\Grant

in() public method

For example a FIND REFERENCES uses the IN in order to find documents referencing to a given document in N classes.
public in ( array $in, boolean $append = true ) : mixed
$in array
$append boolean
return mixed

index() public method

Creates a index
public index ( string $property, string $type, string $class = null ) : Query
$property string
$type string
$class string
return Query

indexCount() public method

Count the elements of the index $indexName.
public indexCount ( string $indexName )
$indexName string

indexPut() public method

Puts a new entry in the index $indexName with the given $key and $rid.
public indexPut ( string $indexName, string $key, string $rid )
$indexName string
$key string
$rid string

indexRemove() public method

Removes the index $indexName with the given $key/$rid.
public indexRemove ( string $indexName, string $key, string $rid = null )
$indexName string
$key string
$rid string

insert() public method

Converts the query into an INSERT.
public insert ( ) : Query
return Query

into() public method

Inserts the INTO clause to a query.
public into ( string $target ) : Query
$target string
return Query

limit() public method

Adds a limit to the current query.
public limit ( $limit )

lookup() public method

public lookup ( $indexName )

manageClass() protected method

Sets the right class command based on the $action.
protected manageClass ( string $action, string $class )
$action string
$class string

manageProperty() protected method

Sets the right property command based on the $action.
protected manageProperty ( string $action, string $class, string $property, $type = null, $linked = null )
$action string
$class string
$property string

on() public method

Sets the ON clause of a query.
public on ( string $on ) : Query
$on string
return Query

orWhere() public method

Adds an OR clause to the query.
public orWhere ( string $condition, mixed $value = null )
$condition string
$value mixed

orderBy() public method

Orders the query.
public orderBy ( array $order, boolean $append = true, boolean $first = false )
$order array
$append boolean
$first boolean

put() public method

Changes the internal command to an PUT, setting the class to update and the values to be written.
public put ( array $values, string $class, $append = true ) : Command
$values array
$class string
return Command

rebuild() public method

Rebuild the index $indexName
public rebuild ( string $indexName )
$indexName string

remove() public method

Removes a link from a link-set|list.
public remove ( array $updates, string $class, boolean $append = true ) : Remove
$updates array
$class string
$append boolean
return Remove

resetWhere() public method

Resets the WHERE conditions.
public resetWhere ( )

revoke() public method

Converts the query into an REVOKE with the given $permission.
public revoke ( string $permission ) : Revoke
$permission string
return Doctrine\OrientDB\Query\Command\Credential\Revoke

select() public method

Adds an array of fields into the select part of the query.
public select ( array $projections, boolean $append = true )
$projections array
$append boolean

setCommands() protected method

Sets the internal command classes to use
protected setCommands ( array $commands ) : true
$commands array
return true

skip() public method

Adds a skip clause to the current query.
public skip ( $records )

to() public method

Adds a subject to the query.
public to ( string $to ) : Query
$to string
return Query

truncate() public method

Truncates an entity.
public truncate ( string $entity, boolean $andCluster = false ) : Query
$entity string
$andCluster boolean
return Query

type() public method

Sets the type clause of a query.
public type ( string $type ) : Query
$type string
return Query

unindex() public method

Removes a index
public unindex ( string $property, string $class = null ) : Query
$property string
$class string
return Query

update() public method

Changes the internal command to an UPDATE, setting the class to update.
public update ( string $class ) : Command
$class string
return Command

values() public method

Sets the values to be inserted into the current query.
public values ( array $values, boolean $append = true ) : Insert
$values array
$append boolean
return Doctrine\OrientDB\Query\Command\Insert

where() public method

Adds the WHERE clause.
public where ( string $condition, mixed $value = null )
$condition string
$value mixed

Property Details

$command protected property

protected $command

$commands protected property

protected $commands