Browse Source

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

tags/2.0.0-beta
Klimov Paul 11 years ago
parent
commit
2c22fe3f25
  1. 18
      extensions/sphinx/ActiveQuery.php
  2. 4
      extensions/sphinx/ActiveRecord.php
  3. 7
      extensions/sphinx/Schema.php

18
extensions/sphinx/ActiveQuery.php

@ -67,15 +67,29 @@ class ActiveQuery extends Query implements ActiveQueryInterface
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
* [[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!
* @return static the query object itself
*/
public function snippetByModel()
{
$this->snippetCallback(array($this, 'fetchSnippetSourceFromModels'));
$this->snippetCallback([$this, 'fetchSnippetSourceFromModels']);
return $this;
}

4
extensions/sphinx/ActiveRecord.php

@ -361,9 +361,9 @@ abstract class ActiveRecord extends Model
* (because another user has modified the data), a [[StaleObjectException]] exception will be thrown,
* 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`.
* Override this method to return the name of this column.

7
extensions/sphinx/Schema.php

@ -317,13 +317,8 @@ class Schema extends Object
if (!is_string($str)) {
return $str;
}
$this->db->open();
if (($value = $this->db->pdo->quote($str)) !== false) {
return $value;
} else { // the driver doesn't support quote (e.g. oci)
return "'" . addcslashes(str_replace("'", "''", $str), "\000\n\r\\\032") . "'";
}
return $this->db->pdo->quote($str);
}
/**

Loading…
Cancel
Save