updated docs about Expression class

fixes #10647
This commit is contained in:
Carsten Brandt
2016-01-27 15:33:01 +01:00
parent cb7d290416
commit c3240525df

View File

@ -9,15 +9,20 @@ namespace yii\db;
/**
* Expression represents a DB expression that does not need escaping or quoting.
*
* When an Expression object is embedded within a SQL statement or fragment,
* it will be replaced with the [[expression]] property value without any
* DB escaping or quoting. For example,
*
* ```php
* $expression = new Expression('NOW()');
* $sql = 'SELECT ' . $expression; // SELECT NOW()
* $now = (new \yii\db\Query)->select($expression)->scalar(); // SELECT NOW();
* echo $now; // prints the current date
* ```
*
* Expression objects are mainly created for passing raw SQL expressions to methods of
* [[Query]], [[ActiveQuery]], and related classes.
*
* An expression can also be bound with parameters specified via [[params]].
*
* @author Qiang Xue <qiang.xue@gmail.com>