From 73442fb12a39f4b3eb2ea72a619efcd65cf79bdd Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 30 Nov 2013 15:51:20 -0500 Subject: [PATCH] doc fix. --- extensions/elasticsearch/Connection.php | 3 ++ extensions/elasticsearch/QueryBuilder.php | 54 +------------------------------ extensions/sphinx/Connection.php | 3 -- framework/yii/base/Application.php | 1 + framework/yii/base/Widget.php | 3 +- framework/yii/db/ActiveRecord.php | 13 -------- framework/yii/log/EmailTarget.php | 5 ++- framework/yii/mail/BaseMessage.php | 2 -- 8 files changed, 9 insertions(+), 75 deletions(-) diff --git a/extensions/elasticsearch/Connection.php b/extensions/elasticsearch/Connection.php index d5275e8..0c28d40 100644 --- a/extensions/elasticsearch/Connection.php +++ b/extensions/elasticsearch/Connection.php @@ -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 * @since 2.0 */ diff --git a/extensions/elasticsearch/QueryBuilder.php b/extensions/elasticsearch/QueryBuilder.php index 5ed77e6..9201f9a 100644 --- a/extensions/elasticsearch/QueryBuilder.php +++ b/extensions/elasticsearch/QueryBuilder.php @@ -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 * @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); } } diff --git a/extensions/sphinx/Connection.php b/extensions/sphinx/Connection.php index b6519d3..b732d97 100644 --- a/extensions/sphinx/Connection.php +++ b/extensions/sphinx/Connection.php @@ -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 * @since 2.0 diff --git a/framework/yii/base/Application.php b/framework/yii/base/Application.php index 3e176f4..93a38c9 100644 --- a/framework/yii/base/Application.php +++ b/framework/yii/base/Application.php @@ -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]]. diff --git a/framework/yii/base/Widget.php b/framework/yii/base/Widget.php index c64cdf4..5e3ce2b 100644 --- a/framework/yii/base/Widget.php +++ b/framework/yii/base/Widget.php @@ -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. * diff --git a/framework/yii/db/ActiveRecord.php b/framework/yii/db/ActiveRecord.php index 0d79d3e..adcf508 100644 --- a/framework/yii/db/ActiveRecord.php +++ b/framework/yii/db/ActiveRecord.php @@ -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 * @author Carsten Brandt * @since 2.0 diff --git a/framework/yii/log/EmailTarget.php b/framework/yii/log/EmailTarget.php index 95234d2..b924420 100644 --- a/framework/yii/log/EmailTarget.php +++ b/framework/yii/log/EmailTarget.php @@ -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 * @since 2.0 diff --git a/framework/yii/mail/BaseMessage.php b/framework/yii/mail/BaseMessage.php index c23f96a..d2594fc 100644 --- a/framework/yii/mail/BaseMessage.php +++ b/framework/yii/mail/BaseMessage.php @@ -18,8 +18,6 @@ use Yii; * * @see BaseMailer * - * @property MailerInterface $mailer The mailer component. This property is read-only. - * * @author Paul Klimov * @since 2.0 */