Commit 2c22fe3f by Klimov Paul

Code style and docs at "yii\sphinx\*" fixed.

parent 400b5310
...@@ -67,15 +67,29 @@ class ActiveQuery extends Query implements ActiveQueryInterface ...@@ -67,15 +67,29 @@ class ActiveQuery extends Query implements ActiveQueryInterface
public $sql; public $sql;
/** /**
* Sets the [[snippetCallback]] to [[fetchSnippetSourceFromModels]], which allows to * Sets the [[snippetCallback]] to [[fetchSnippetSourceFromModels()]], which allows to
* fetch the snippet source strings from the Active Record models, using method * fetch the snippet source strings from the Active Record models, using method
* [[ActiveRecord::getSnippetSource()]]. * [[ActiveRecord::getSnippetSource()]].
* For example:
*
* ~~~
* class Article extends ActiveRecord
* {
* public function getSnippetSource()
* {
* return file_get_contents('/path/to/source/files/' . $this->id . '.txt');;
* }
* }
*
* $articles = Article::find()->snippetByModel()->all();
* ~~~
*
* Warning: this option should NOT be used with [[asArray]] at the same time! * Warning: this option should NOT be used with [[asArray]] at the same time!
* @return static the query object itself * @return static the query object itself
*/ */
public function snippetByModel() public function snippetByModel()
{ {
$this->snippetCallback(array($this, 'fetchSnippetSourceFromModels')); $this->snippetCallback([$this, 'fetchSnippetSourceFromModels']);
return $this; return $this;
} }
......
...@@ -361,9 +361,9 @@ abstract class ActiveRecord extends Model ...@@ -361,9 +361,9 @@ abstract class ActiveRecord extends Model
* (because another user has modified the data), a [[StaleObjectException]] exception will be thrown, * (because another user has modified the data), a [[StaleObjectException]] exception will be thrown,
* and the update or deletion is skipped. * and the update or deletion is skipped.
* *
* Optimized locking is only supported by [[update()]] and [[delete()]]. * Optimistic locking is only supported by [[update()]] and [[delete()]].
* *
* To use optimized locking: * To use optimistic locking:
* *
* 1. Create a column to store the version number of each row. The column type should be `BIGINT DEFAULT 0`. * 1. Create a column to store the version number of each row. The column type should be `BIGINT DEFAULT 0`.
* Override this method to return the name of this column. * Override this method to return the name of this column.
......
...@@ -317,13 +317,8 @@ class Schema extends Object ...@@ -317,13 +317,8 @@ class Schema extends Object
if (!is_string($str)) { if (!is_string($str)) {
return $str; return $str;
} }
$this->db->open(); $this->db->open();
if (($value = $this->db->pdo->quote($str)) !== false) { return $this->db->pdo->quote($str);
return $value;
} else { // the driver doesn't support quote (e.g. oci)
return "'" . addcslashes(str_replace("'", "''", $str), "\000\n\r\\\032") . "'";
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment