mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-09 23:18:07 +08:00
doc fix.
This commit is contained in:
@@ -15,6 +15,9 @@ use yii\helpers\Json;
|
||||
/**
|
||||
* elasticsearch Connection is used to connect to an elasticsearch cluster version 0.20 or higher
|
||||
*
|
||||
* @property string $driverName Name of the DB driver. This property is read-only.
|
||||
* @property boolean $isActive Whether the DB connection is established. This property is read-only.
|
||||
*
|
||||
* @author Carsten Brandt <mail@cebe.cc>
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,6 @@ use yii\helpers\Json;
|
||||
/**
|
||||
* QueryBuilder builds an elasticsearch query based on the specification given as a [[Query]] object.
|
||||
*
|
||||
*
|
||||
* @author Carsten Brandt <mail@cebe.cc>
|
||||
* @since 2.0
|
||||
*/
|
||||
@@ -247,7 +246,7 @@ class QueryBuilder extends \yii\base\Object
|
||||
}
|
||||
|
||||
if (count($column) > 1) {
|
||||
return $this->buildCompositeInCondition($operator, $column, $values, $params);
|
||||
return $this->buildCompositeInCondition($operator, $column, $values);
|
||||
} elseif (is_array($column)) {
|
||||
$column = reset($column);
|
||||
}
|
||||
@@ -289,61 +288,10 @@ class QueryBuilder extends \yii\base\Object
|
||||
protected function buildCompositeInCondition($operator, $columns, $values)
|
||||
{
|
||||
throw new NotSupportedException('composite in is not supported by elasticsearch.');
|
||||
$vss = array();
|
||||
foreach ($values as $value) {
|
||||
$vs = array();
|
||||
foreach ($columns as $column) {
|
||||
if (isset($value[$column])) {
|
||||
$phName = self::PARAM_PREFIX . count($params);
|
||||
$params[$phName] = $value[$column];
|
||||
$vs[] = $phName;
|
||||
} else {
|
||||
$vs[] = 'NULL';
|
||||
}
|
||||
}
|
||||
$vss[] = '(' . implode(', ', $vs) . ')';
|
||||
}
|
||||
foreach ($columns as $i => $column) {
|
||||
if (strpos($column, '(') === false) {
|
||||
$columns[$i] = $this->db->quoteColumnName($column);
|
||||
}
|
||||
}
|
||||
return '(' . implode(', ', $columns) . ") $operator (" . implode(', ', $vss) . ')';
|
||||
}
|
||||
|
||||
private function buildLikeCondition($operator, $operands)
|
||||
{
|
||||
throw new NotSupportedException('like conditions is not supported by elasticsearch.');
|
||||
if (!isset($operands[0], $operands[1])) {
|
||||
throw new Exception("Operator '$operator' requires two operands.");
|
||||
}
|
||||
|
||||
list($column, $values) = $operands;
|
||||
|
||||
$values = (array)$values;
|
||||
|
||||
if (empty($values)) {
|
||||
return $operator === 'LIKE' || $operator === 'OR LIKE' ? '0==1' : '';
|
||||
}
|
||||
|
||||
if ($operator === 'LIKE' || $operator === 'NOT LIKE') {
|
||||
$andor = ' AND ';
|
||||
} else {
|
||||
$andor = ' OR ';
|
||||
$operator = $operator === 'OR LIKE' ? 'LIKE' : 'NOT LIKE';
|
||||
}
|
||||
|
||||
if (strpos($column, '(') === false) {
|
||||
$column = $this->db->quoteColumnName($column);
|
||||
}
|
||||
|
||||
$parts = array();
|
||||
foreach ($values as $value) {
|
||||
$phName = self::PARAM_PREFIX . count($params);
|
||||
$params[$phName] = $value;
|
||||
$parts[] = "$column $operator $phName";
|
||||
}
|
||||
|
||||
return implode($andor, $parts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +52,6 @@ use yii\base\NotSupportedException;
|
||||
*
|
||||
* @property string $lastInsertID The row ID of the last row inserted, or the last value retrieved from the
|
||||
* sequence object. This property is read-only.
|
||||
* @property Schema $schema The schema information for this Sphinx connection. This property is read-only.
|
||||
* @property \yii\sphinx\QueryBuilder $queryBuilder The query builder for this Sphinx connection. This property is
|
||||
* read-only.
|
||||
*
|
||||
* @author Paul Klimov <klimov.paul@gmail.com>
|
||||
* @since 2.0
|
||||
|
||||
@@ -23,6 +23,7 @@ use yii\web\HttpException;
|
||||
* @property \yii\base\Formatter $formatter The formatter application component. This property is read-only.
|
||||
* @property \yii\i18n\I18N $i18n The internationalization component. This property is read-only.
|
||||
* @property \yii\log\Logger $log The log component. This property is read-only.
|
||||
* @property \yii\mail\MailerInterface $mail The mailer interface. This property is read-only.
|
||||
* @property \yii\web\Request|\yii\console\Request $request The request component. This property is read-only.
|
||||
* @property string $runtimePath The directory that stores runtime files. Defaults to the "runtime"
|
||||
* subdirectory under [[basePath]].
|
||||
|
||||
@@ -14,7 +14,8 @@ use ReflectionClass;
|
||||
* Widget is the base class for widgets.
|
||||
*
|
||||
* @property string $id ID of the widget.
|
||||
* @property View $view The view object that can be used to render views or view files.
|
||||
* @property \yii\web\View $view The view object that can be used to render views or view files. Note that the
|
||||
* type of this property differs in getter and setter. See [[getView()]] and [[setView()]] for details.
|
||||
* @property string $viewPath The directory containing the view files for this widget. This property is
|
||||
* read-only.
|
||||
*
|
||||
|
||||
@@ -22,19 +22,6 @@ use yii\helpers\Inflector;
|
||||
*
|
||||
* @include @yii/db/ActiveRecord.md
|
||||
*
|
||||
* @property array $dirtyAttributes The changed attribute values (name-value pairs). This property is
|
||||
* read-only.
|
||||
* @property boolean $isNewRecord Whether the record is new and should be inserted when calling [[save()]].
|
||||
* @property array $oldAttributes The old attribute values (name-value pairs).
|
||||
* @property mixed $oldPrimaryKey The old primary key value. An array (column name => column value) is
|
||||
* returned if the primary key is composite. A string is returned otherwise (null will be returned if the key
|
||||
* value is null). This property is read-only.
|
||||
* @property array $populatedRelations An array of relation data indexed by relation names. This property is
|
||||
* read-only.
|
||||
* @property mixed $primaryKey The primary key value. An array (column name => column value) is returned if
|
||||
* the primary key is composite. A string is returned otherwise (null will be returned if the key value is null).
|
||||
* This property is read-only.
|
||||
*
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @author Carsten Brandt <mail@cebe.cc>
|
||||
* @since 2.0
|
||||
|
||||
@@ -14,9 +14,8 @@ use yii\mail\MailerInterface;
|
||||
/**
|
||||
* EmailTarget sends selected log messages to the specified email addresses.
|
||||
*
|
||||
* The target email addresses may be specified via [[emails]] property.
|
||||
* Optionally, you may set the email [[subject]], [[sentFrom]] address and
|
||||
* additional [[headers]].
|
||||
* You may configure the email to be sent by setting the [[message]] property, through which
|
||||
* you can set the target email addresses, subject, etc.
|
||||
*
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @since 2.0
|
||||
|
||||
@@ -18,8 +18,6 @@ use Yii;
|
||||
*
|
||||
* @see BaseMailer
|
||||
*
|
||||
* @property MailerInterface $mailer The mailer component. This property is read-only.
|
||||
*
|
||||
* @author Paul Klimov <klimov.paul@gmail.com>
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user