Class SqlCompatibleBehavior

Description

SqlCompatibleBehavior class

  • uses: ModelBehavior

Located in /behaviors/sql_compatible.php (line 31)

ModelBehavior
   |
   --SqlCompatibleBehavior
Variable Summary
string $name
array $settings
Method Summary
void afterFind ( &$Model, mixed $results, mixed $primary, mixed $Model)
void beforeFind ( &$Model, mixed $query, mixed $Model)
void convertDates ( &$results, mixed $results)
void setup ( &$Model, [array $config = array()], mixed $Model)
void _translateConditions ( &$Model,  &$conditions, mixed $Model, mixed $conditions)
string _translateOperator (mixed $Model, mixed $operator)
Variables
string $name = 'SqlCompatible' (line 39)

name property

  • var: 'SqlCompatible'
  • access: public
array $settings = array() (line 49)

Runtime settings

Keyed on model alias

  • access: public
array $_defaultSettings = array(
'convertDates' => true,
'operators' => array(
'!=' => '$ne',
'>' => '$gt',
'>=' => '$gte',
'<' => '$lt',
'<=' => '$lte',
'IN' => '$in',
'NOT' => '$not',
'NOT IN' => '$nin'
))
(line 57)

defaultSettings property

  • access: protected
Methods
afterFind (line 94)

If requested, convert dates from MongoDate objects to standard date strings

  • access: public
void afterFind ( &$Model, mixed $results, mixed $primary, mixed $Model)
  • mixed $Model
  • mixed $results
  • mixed $primary
  • &$Model
beforeFind (line 111)

beforeFind method

If conditions are an array ensure they are mongified

  • access: public
void beforeFind ( &$Model, mixed $query, mixed $Model)
  • mixed $Model
  • mixed $query
  • &$Model
convertDates (line 125)

Convert MongoDate objects to strings for the purpose of view simplicity

  • access: public
void convertDates ( &$results, mixed $results)
  • mixed $results
  • &$results
setup (line 81)

setup method

Allow overriding the operator map

  • access: public
void setup ( &$Model, [array $config = array()], mixed $Model)
  • mixed $Model
  • array $config: array()
  • &$Model
_translateConditions (line 145)

translateConditions method

Loop on conditions and desqlify them

  • access: protected
void _translateConditions ( &$Model,  &$conditions, mixed $Model, mixed $conditions)
  • mixed $Model
  • mixed $conditions
  • &$Model
  • &$conditions
_translateOperator (line 264)

translateOperator method

Use the operator map for the model and return what the db really wants to hear

  • access: protected
string _translateOperator (mixed $Model, mixed $operator)
  • mixed $Model
  • mixed $operator

Documentation generated on Tue, 26 Jul 2011 01:09:02 +0900 by phpDocumentor 1.4.3