Doctrine 1.2.4
Doctrine_Hook_Parser_Complex Class Reference

Inherits Doctrine_Hook_Parser.

Inherited by Doctrine_Hook_Integer, and Doctrine_Hook_WordLike.

Public Member Functions

 __construct ()
 
 getParams ()
 
 parse ($alias, $field, $value)
 
 parseClause ($alias, $field, $value)
 
 parseSingle ($alias, $field, $value)
 

Detailed Description

Definition at line 33 of file Complex.php.

Constructor & Destructor Documentation

Doctrine_Hook_Parser_Complex::__construct ( )

Constructor.

Definition at line 40 of file Complex.php.

{
$this->_tokenizer = new Doctrine_Query_Tokenizer();
}

Member Function Documentation

Doctrine_Hook_Parser::getParams ( )
inherited

getParams returns the parameters associated with this parser

Returns
array

Definition at line 49 of file Parser.php.

{
return $this->params;
}
Doctrine_Hook_Parser_Complex::parse (   $alias,
  $field,
  $value 
)

parse Parses given field and field value to DQL condition and parameters. This method should always return prepared statement conditions (conditions that use placeholders instead of literal values).

Parameters
string$aliascomponent alias
string$fieldthe field name
mixed$valuethe value of the field
Returns
void

Definition at line 57 of file Complex.php.

{
$this->condition = $this->parseClause($alias, $field, $value);
}
Doctrine_Hook_Parser_Complex::parseClause (   $alias,
  $field,
  $value 
)

parseClause

Parameters
string$aliascomponent alias
string$fieldthe field name
mixed$valuethe value of the field
Returns
void

Definition at line 70 of file Complex.php.

{
$parts = $this->_tokenizer->quoteExplode($value, ' AND ');
if (count($parts) > 1) {
$ret = array();
foreach ($parts as $part) {
$ret[] = $this->parseSingle($alias, $field, $part);
}
$r = implode(' AND ', $ret);
} else {
$parts = $this->_tokenizer->quoteExplode($value, ' OR ');
if (count($parts) > 1) {
$ret = array();
foreach ($parts as $part) {
$ret[] = $this->parseClause($alias, $field, $part);
}
$r = implode(' OR ', $ret);
} else {
$ret = $this->parseSingle($alias, $field, $parts[0]);
return $ret;
}
}
return '(' . $r . ')';
}
Doctrine_Hook_Parser_Complex::parseSingle (   $alias,
  $field,
  $value 
)
abstract

parseSingle

Parameters
string$aliascomponent alias
string$fieldthe field name
mixed$valuethe value of the field
Returns
void

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