Hoa central
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Hoa\Database\Query\Query Class Reference

Public Member Functions

 setId ($id)
 
 getId ()
 
 select ($column=null)
 
 insert ()
 
 update ()
 
 delete ()
 
 where ($expression)
 

Static Public Member Functions

static get ($id)
 
static getReference ($id)
 

Protected Member Functions

 store ($object)
 

Protected Attributes

 $_id = null
 

Static Protected Attributes

static $_queries = []
 

Detailed Description

Class .

Multiton of queries.

Definition at line 49 of file Query.php.

Member Function Documentation

Hoa\Database\Query\Query::delete ( )

Start a DELETE query.

Returns

Definition at line 127 of file Query.php.

128  {
129  return $this->store(new Delete());
130  }

Here is the call graph for this function:

static Hoa\Database\Query\Query::get (   $id)
static

Get a query (a clone of it).

Parameters
string$idID.
Returns

Definition at line 170 of file Query.php.

171  {
172  if (null === $out = static::getReference($id)) {
173  return null;
174  }
175 
176  return clone $out;
177  }
Hoa\Database\Query\Query::getId ( )

Get current instance ID.

Returns
string

Definition at line 85 of file Query.php.

86  {
87  return $this->_id;
88  }

Here is the caller graph for this function:

static Hoa\Database\Query\Query::getReference (   $id)
static

Get a query (not a clone of it).

Parameters
string$idID.
Returns

Definition at line 185 of file Query.php.

186  {
187  if (false === array_key_exists($id, static::$_queries)) {
188  return null;
189  }
190 
191  return static::$_queries[$id];
192  }
Hoa\Database\Query\Query::insert ( )

Start an INSERT query.

Returns

Definition at line 107 of file Query.php.

108  {
109  return $this->store(new Insert());
110  }

Here is the call graph for this function:

Hoa\Database\Query\Query::select (   $column = null)

Start a START query.

Parameters
string$columnColumn.
......
Returns

Definition at line 97 of file Query.php.

98  {
99  return $this->store(new Select(func_get_args()));
100  }

Here is the call graph for this function:

Hoa\Database\Query\Query::setId (   $id)

Set current instance ID.

Parameters
string$idID.
Returns

Definition at line 73 of file Query.php.

74  {
75  $this->_id = $id;
76 
77  return $this;
78  }
Hoa\Database\Query\Query::store (   $object)
protected

Store the current instance if necessary.

Parameters
\Hoa\Database\Query\Dml$objectObject.
Returns

Definition at line 151 of file Query.php.

152  {
153  if (null === $id = $this->getId()) {
154  $out = $object;
155  } else {
156  $out = static::$_queries[$id] = $object;
157  }
158 
159  $this->_id = null;
160 
161  return $out;
162  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa\Database\Query\Query::update ( )

Start an UPDATE query.

Returns

Definition at line 117 of file Query.php.

118  {
119  return $this->store(new Update());
120  }

Here is the call graph for this function:

Hoa\Database\Query\Query::where (   $expression)

Start a WHERE clause.

Parameters
string$expressionExpression.
Returns

Definition at line 138 of file Query.php.

139  {
140  $where = new Where();
141 
142  return $this->store($where->where($expression));
143  }

Here is the call graph for this function:

Member Data Documentation

Hoa\Database\Query\Query::$_id = null
protected

Definition at line 63 of file Query.php.

Hoa\Database\Query\Query::$_queries = []
staticprotected

Definition at line 56 of file Query.php.


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