From bb6b75e7941d07c2d02471ff953f7f5ce28d9ca5 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Wed, 27 Nov 2013 23:07:15 -0500 Subject: [PATCH 01/30] fixed exception check in test. --- tests/unit/framework/validators/UniqueValidatorTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/framework/validators/UniqueValidatorTest.php b/tests/unit/framework/validators/UniqueValidatorTest.php index d0a7091..707239c 100644 --- a/tests/unit/framework/validators/UniqueValidatorTest.php +++ b/tests/unit/framework/validators/UniqueValidatorTest.php @@ -80,9 +80,9 @@ class UniqueValidatorTest extends DatabaseTestCase public function testValidateAttributeAttributeNotInTableException() { - $this->setExpectedException('yii\base\InvalidConfigException'); + $this->setExpectedException('yii\db\Exception'); $val = new UniqueValidator(); $m = new ValidatorTestMainModel(); $val->validateAttribute($m, 'testMainVal'); } -} \ No newline at end of file +} From 3b5768b40a58103e47705f64ba6cd0140b3583cf Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Wed, 27 Nov 2013 23:35:43 -0500 Subject: [PATCH 02/30] avoid throwing the same type of new db exception. --- framework/yii/db/Command.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/framework/yii/db/Command.php b/framework/yii/db/Command.php index 6ed0d9c..2075b2d 100644 --- a/framework/yii/db/Command.php +++ b/framework/yii/db/Command.php @@ -278,9 +278,13 @@ class Command extends \yii\base\Component return $n; } catch (\Exception $e) { Yii::endProfile($token, __METHOD__); - $message = $e->getMessage() . "\nThe SQL being executed was: $rawSql"; - $errorInfo = $e instanceof \PDOException ? $e->errorInfo : null; - throw new Exception($message, $errorInfo, (int)$e->getCode(), $e); + if ($e instanceof Exception) { + throw $e; + } else { + $message = $e->getMessage() . "\nThe SQL being executed was: $rawSql"; + $errorInfo = $e instanceof \PDOException ? $e->errorInfo : null; + throw new Exception($message, $errorInfo, (int)$e->getCode(), $e); + } } } @@ -411,9 +415,13 @@ class Command extends \yii\base\Component return $result; } catch (\Exception $e) { Yii::endProfile($token, __METHOD__); - $message = $e->getMessage() . "\nThe SQL being executed was: $rawSql"; - $errorInfo = $e instanceof \PDOException ? $e->errorInfo : null; - throw new Exception($message, $errorInfo, (int)$e->getCode(), $e); + if ($e instanceof Exception) { + throw $e; + } else { + $message = $e->getMessage() . "\nThe SQL being executed was: $rawSql"; + $errorInfo = $e instanceof \PDOException ? $e->errorInfo : null; + throw new Exception($message, $errorInfo, (int)$e->getCode(), $e); + } } } From dc79c8c11ad49633353215904266f3e07f44e20a Mon Sep 17 00:00:00 2001 From: Paul Klimov Date: Thu, 28 Nov 2013 11:05:23 +0200 Subject: [PATCH 03/30] Sphinx ignore group removed from phpunit run script --- .travis.yml | 2 +- phpunit.xml.dist | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6eeec4c..b7aea47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ before_script: - tests/unit/data/travis/sphinx-setup.sh #script: -# - phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor,sphinx +# - phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor #after_script: # - php vendor/bin/coveralls diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1f3056e..92c0793 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,7 +11,7 @@ - + framework/yii/helpers/Json.php framework/yii/helpers/StringHelper.php framework/yii/helpers/VarDumper.php @@ -20,7 +20,7 @@ framework/yii/helpers/FileHelper.php framework/yii/helpers/ArrayHelper.php framework/yii/helpers/Console.php - framework/yii/i18n/GettextFile.php + framework/yii/i18n/GettextFile.php framework/yii/web/ResponseFormatterInterface.php framework/yii/base framework/yii/db/mssql From 3dbb3d40ddc68c67e5cada32fc09975cb66c3179 Mon Sep 17 00:00:00 2001 From: Paul Klimov Date: Thu, 28 Nov 2013 11:34:13 +0200 Subject: [PATCH 04/30] Sphinx unit tests fixed. --- extensions/sphinx/ActiveRecord.php | 2 ++ tests/unit/extensions/sphinx/ActiveRecordTest.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/sphinx/ActiveRecord.php b/extensions/sphinx/ActiveRecord.php index 9cf03ff..206c340 100644 --- a/extensions/sphinx/ActiveRecord.php +++ b/extensions/sphinx/ActiveRecord.php @@ -1385,6 +1385,8 @@ abstract class ActiveRecord extends Model $this->populateRelation($offset, $item); return; } + } catch (InvalidParamException $e) { + // shut down exception : has getter, but not relation } catch (UnknownMethodException $e) { throw $e->getPrevious(); } diff --git a/tests/unit/extensions/sphinx/ActiveRecordTest.php b/tests/unit/extensions/sphinx/ActiveRecordTest.php index 0bb9dbb..b167b9e 100644 --- a/tests/unit/extensions/sphinx/ActiveRecordTest.php +++ b/tests/unit/extensions/sphinx/ActiveRecordTest.php @@ -79,10 +79,10 @@ class ActiveRecordTest extends SphinxTestCase // asArray $article = ArticleIndex::find()->where('id=2')->asArray()->one(); + unset($article['add_date']); $this->assertEquals([ 'id' => '2', 'author_id' => '2', - 'add_date' => '1384466400', 'tag' => '3,4', ], $article); From f1452d3070a977e70c3e5584d6cdf08719419805 Mon Sep 17 00:00:00 2001 From: slavcodev Date: Thu, 28 Nov 2013 13:21:30 +0200 Subject: [PATCH 05/30] Remove extra var --- framework/yii/helpers/BaseVarDumper.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/framework/yii/helpers/BaseVarDumper.php b/framework/yii/helpers/BaseVarDumper.php index b11757b..36b739c 100644 --- a/framework/yii/helpers/BaseVarDumper.php +++ b/framework/yii/helpers/BaseVarDumper.php @@ -111,10 +111,9 @@ class BaseVarDumper } else { $id = array_push(self::$_objects, $var); $className = get_class($var); - $members = (array)$var; $spaces = str_repeat(' ', $level * 4); self::$_output .= "$className#$id\n" . $spaces . '('; - foreach ($members as $key => $value) { + foreach ((array)$var as $key => $value) { $keyDisplay = strtr(trim($key), ["\0" => ':']); self::$_output .= "\n" . $spaces . " [$keyDisplay] => "; self::dumpInternal($value, $level + 1); From ce4d7450be1a16f2c2549ede011526ecd30068e6 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 28 Nov 2013 15:53:17 +0400 Subject: [PATCH 06/30] Docs on autoloading and helpers --- docs/guide/basics.md | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/docs/guide/basics.md b/docs/guide/basics.md index 914797c..2fa8f59 100644 --- a/docs/guide/basics.md +++ b/docs/guide/basics.md @@ -78,9 +78,43 @@ directory and Yii will be able to autoload any class in this library. Autoloading ----------- -TBD +All classes, interfaces and traits are loaded automatically at the moment they are used. There's no need to use +`include` or `require`. It is, as well, true for Composer-loaded packages and Yii extensions. + +Autoloader works according to [PSR-0](). That means namespaces and class, interface and trait +names should correspond to file system paths except root namespace path that is defined by an alias. + +For example, if standard alias `@app` refers to `/var/www/example.com/` then `\app\models\User` will be loaded from +`/var/www/example.com/app/models/User.php`. + +Custom alias may be added using the following code: + +```php +Yii::setAlias('shared', realpath('~/src/shared')); +``` + +Additional autoloaders may be registered using standard PHP `spl_autoload_register`. Helper classes -------------- -TDB \ No newline at end of file +Helper class typically contains static methods only and used as follows: + +```php +use \yii\helpers\Html; +echo Html::encode('Test > test'); +``` + +There are several classes provided by framework: + +- ArrayHelper +- Console +- FileHelper +- Html +- HtmlPurifier +- Inflector +- Json +- Markdown +- Security +- StringHelper +- VarDumper \ No newline at end of file From 5d9cd76a7112b532e97be42352ef9c0ff809f0e9 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 28 Nov 2013 16:03:45 +0400 Subject: [PATCH 07/30] Provided example setting YII_DEBUG to false --- docs/guide/configuration.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/guide/configuration.md b/docs/guide/configuration.md index 5f1d8e0..11f2470 100644 --- a/docs/guide/configuration.md +++ b/docs/guide/configuration.md @@ -21,7 +21,11 @@ console applications it's `yii`. Both are doing nearly the same job: 5. Creating new application instance using `$config` and running it. The Bootstrap file is not the part of framework but your application so it's OK to adjust it to fit your application. Typical -adjustments are the value of `YII_DEBUG` that should never be `true` on production and the way config is read. +adjustments are the value of `YII_DEBUG` that should never be `true` on production and the way config is read: + +```php +defined('YII_DEBUG') or define('YII_DEBUG', false); +``` Configuring application instance -------------------------------- From 0390a998333b10755f53013999a0475dc299afea Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 28 Nov 2013 09:04:16 -0500 Subject: [PATCH 08/30] Use backquotes to quote column and table names for sqlite (related with #1318) --- framework/yii/db/sqlite/Schema.php | 22 ++++++++++++++++++++++ .../unit/framework/db/sqlite/SqliteCommandTest.php | 2 +- .../framework/db/sqlite/SqliteConnectionTest.php | 8 ++++---- .../framework/db/sqlite/SqliteQueryBuilderTest.php | 2 +- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/framework/yii/db/sqlite/Schema.php b/framework/yii/db/sqlite/Schema.php index 38fbf3a..8633650 100644 --- a/framework/yii/db/sqlite/Schema.php +++ b/framework/yii/db/sqlite/Schema.php @@ -50,6 +50,28 @@ class Schema extends \yii\db\Schema ]; /** + * Quotes a table name for use in a query. + * A simple table name has no schema prefix. + * @param string $name table name + * @return string the properly quoted table name + */ + public function quoteSimpleTableName($name) + { + return strpos($name, "`") !== false ? $name : "`" . $name . "`"; + } + + /** + * Quotes a column name for use in a query. + * A simple column name has no prefix. + * @param string $name column name + * @return string the properly quoted column name + */ + public function quoteSimpleColumnName($name) + { + return strpos($name, '`') !== false || $name === '*' ? $name : '`' . $name . '`'; + } + + /** * Creates a query builder for the MySQL database. * This method may be overridden by child classes to create a DBMS-specific query builder. * @return QueryBuilder query builder instance diff --git a/tests/unit/framework/db/sqlite/SqliteCommandTest.php b/tests/unit/framework/db/sqlite/SqliteCommandTest.php index 1f9ddc2..c8cb35c 100644 --- a/tests/unit/framework/db/sqlite/SqliteCommandTest.php +++ b/tests/unit/framework/db/sqlite/SqliteCommandTest.php @@ -17,6 +17,6 @@ class SqliteCommandTest extends CommandTest $sql = 'SELECT [[id]], [[t.name]] FROM {{tbl_customer}} t'; $command = $db->createCommand($sql); - $this->assertEquals("SELECT \"id\", 't'.\"name\" FROM 'tbl_customer' t", $command->sql); + $this->assertEquals("SELECT `id`, `t`.`name` FROM `tbl_customer` t", $command->sql); } } diff --git a/tests/unit/framework/db/sqlite/SqliteConnectionTest.php b/tests/unit/framework/db/sqlite/SqliteConnectionTest.php index e1a2961..ea74f81 100644 --- a/tests/unit/framework/db/sqlite/SqliteConnectionTest.php +++ b/tests/unit/framework/db/sqlite/SqliteConnectionTest.php @@ -30,8 +30,8 @@ class SqliteConnectionTest extends ConnectionTest public function testQuoteTableName() { $connection = $this->getConnection(false); - $this->assertEquals("'table'", $connection->quoteTableName('table')); - $this->assertEquals("'schema'.'table'", $connection->quoteTableName('schema.table')); + $this->assertEquals("`table`", $connection->quoteTableName('table')); + $this->assertEquals("`schema`.`table`", $connection->quoteTableName('schema.table')); $this->assertEquals('{{table}}', $connection->quoteTableName('{{table}}')); $this->assertEquals('(table)', $connection->quoteTableName('(table)')); } @@ -39,8 +39,8 @@ class SqliteConnectionTest extends ConnectionTest public function testQuoteColumnName() { $connection = $this->getConnection(false); - $this->assertEquals('"column"', $connection->quoteColumnName('column')); - $this->assertEquals("'table'.\"column\"", $connection->quoteColumnName('table.column')); + $this->assertEquals('`column`', $connection->quoteColumnName('column')); + $this->assertEquals("`table`.`column`", $connection->quoteColumnName('table.column')); $this->assertEquals('[[column]]', $connection->quoteColumnName('[[column]]')); $this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}')); $this->assertEquals('(column)', $connection->quoteColumnName('(column)')); diff --git a/tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php b/tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php index 67cae28..a2408a6 100644 --- a/tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php +++ b/tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php @@ -85,6 +85,6 @@ class SqliteQueryBuilderTest extends QueryBuilderTest public function testBatchInsert() { $sql = $this->getQueryBuilder()->batchInsert('{{tbl_customer}} t', ['t.id','t.name'], array(array(1,'a'), array(2,'b'))); - $this->assertEquals("INSERT INTO {{tbl_customer}} t ('t'.\"id\", 't'.\"name\") SELECT 1, 'a' UNION ALL 2, 'b'", $sql); + $this->assertEquals("INSERT INTO {{tbl_customer}} t (`t`.`id`, `t`.`name`) SELECT 1, 'a' UNION ALL 2, 'b'", $sql); } } From d6f97ff4c17799e6d953038c3ff84a9b88e9d725 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 28 Nov 2013 09:08:02 -0500 Subject: [PATCH 09/30] Added Application::getMail(). --- framework/yii/base/Application.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/framework/yii/base/Application.php b/framework/yii/base/Application.php index 4f2bee2..48b526c 100644 --- a/framework/yii/base/Application.php +++ b/framework/yii/base/Application.php @@ -459,6 +459,15 @@ abstract class Application extends Module } /** + * Returns the mailer component. + * @return \yii\mail\MailerInterface the mailer interface + */ + public function getMail() + { + return $this->getComponent('mail'); + } + + /** * Returns the auth manager for this application. * @return \yii\rbac\Manager the auth manager for this application. */ From c22409e397fa724de5ce7e0e4582ca1093a6f2e0 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 28 Nov 2013 09:22:08 -0500 Subject: [PATCH 10/30] Fixed test break using file transport. --- tests/unit/VendorTestCase.php | 2 +- tests/unit/extensions/swiftmailer/MessageTest.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/unit/VendorTestCase.php b/tests/unit/VendorTestCase.php index 2002cb3..71a2648 100644 --- a/tests/unit/VendorTestCase.php +++ b/tests/unit/VendorTestCase.php @@ -27,4 +27,4 @@ class VendorTestCase extends TestCase throw new NotSupportedException("Vendor autoload file '{$vendorAutoload}' is missing."); } } -} \ No newline at end of file +} diff --git a/tests/unit/extensions/swiftmailer/MessageTest.php b/tests/unit/extensions/swiftmailer/MessageTest.php index 1f55cc6..31a5c43 100644 --- a/tests/unit/extensions/swiftmailer/MessageTest.php +++ b/tests/unit/extensions/swiftmailer/MessageTest.php @@ -56,7 +56,9 @@ class MessageTest extends VendorTestCase */ protected function createTestEmailComponent() { - $component = new Mailer(); + $component = new Mailer([ + 'useFileTransport' => true, + ]); return $component; } From eb3b2f45bcc2464b0e6fc8fcc9d782f110c92ed9 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 28 Nov 2013 09:46:20 -0500 Subject: [PATCH 11/30] refactored EmailTarget with the new mailer interfaces. --- framework/yii/BaseYii.php | 2 ++ framework/yii/log/EmailTarget.php | 70 ++++++++++++++++++++++----------------- framework/yii/log/Target.php | 2 +- 3 files changed, 43 insertions(+), 31 deletions(-) diff --git a/framework/yii/BaseYii.php b/framework/yii/BaseYii.php index ee49c8e..e56d410 100644 --- a/framework/yii/BaseYii.php +++ b/framework/yii/BaseYii.php @@ -519,12 +519,14 @@ class BaseYii * Configures an object with the initial property values. * @param object $object the object to be configured * @param array $properties the property initial values given in terms of name-value pairs. + * @return object the object itself */ public static function configure($object, $properties) { foreach ($properties as $name => $value) { $object->$name = $value; } + return $object; } /** diff --git a/framework/yii/log/EmailTarget.php b/framework/yii/log/EmailTarget.php index 8ca3d97..69019e3 100644 --- a/framework/yii/log/EmailTarget.php +++ b/framework/yii/log/EmailTarget.php @@ -7,6 +7,10 @@ namespace yii\log; +use Yii; +use yii\base\InvalidConfigException; +use yii\mail\MailerInterface; + /** * EmailTarget sends selected log messages to the specified email addresses. * @@ -20,51 +24,57 @@ namespace yii\log; class EmailTarget extends Target { /** - * @var array list of destination email addresses. - */ - public $emails = []; - /** - * @var string email subject + * @var array the configuration array for creating a [[\yii\mail\MessageInterface|message]] object. + * Note that the "to" option must be set, which specifies the destination email address(es). */ - public $subject; + public $message = []; /** - * @var string email sent-from address + * @var MailerInterface|string the mailer object or the application component ID of the mailer object. + * After the EmailTarget object is created, if you want to change this property, you should only assign it + * with a mailer object. */ - public $sentFrom; + public $mail = 'mail'; + /** - * @var array list of additional headers to use when sending an email. + * @inheritdoc */ - public $headers = []; + public function init() + { + parent::init(); + if (empty($this->message['to'])) { + throw new InvalidConfigException('The "to" option must be set for EmailTarget::message.'); + } + if (empty($this->message['subject'])) { + $this->message['subject'] = Yii::t('yii', 'Application Log'); + } + if (is_string($this->mail)) { + $this->mail = Yii::$app->getComponent($this->mail); + } + if (!$this->mail instanceof MailerInterface) { + throw new InvalidConfigException("EmailTarget::mailer must be either a mailer object or the application component ID of a mailer object."); + } + } /** * Sends log messages to specified email addresses. */ public function export() { - $body = ''; - foreach ($this->messages as $message) { - $body .= $this->formatMessage($message); - } - $body = wordwrap($body, 70); - $subject = $this->subject === null ? \Yii::t('yii', 'Application Log') : $this->subject; - foreach ($this->emails as $email) { - $this->sendEmail($subject, $body, $email, $this->sentFrom, $this->headers); - } + $message = $this->mail->compose(); + Yii::configure($message, $this->message); + $this->composeMessage($message); + $this->mail->send($message); } /** - * Sends an email. - * @param string $subject email subject - * @param string $body email body - * @param string $sentTo sent-to email address - * @param string $sentFrom sent-from email address - * @param array $headers additional headers to be used when sending the email + * Composes the given mail message with body content. + * The default implementation fills the text body of the message with the log messages. + * @param \yii\mail\MessageInterface $message */ - protected function sendEmail($subject, $body, $sentTo, $sentFrom, $headers) + protected function composeMessage($message) { - if ($sentFrom !== null) { - $headers[] = "From: {$sentFrom}"; - } - mail($sentTo, $subject, $body, implode("\r\n", $headers)); + $messages = array_map([$this, 'formatMessage'], $this->messages); + $body = wordwrap(implode("\n", $messages), 70); + $message->setTextBody($body); } } diff --git a/framework/yii/log/Target.php b/framework/yii/log/Target.php index c9d5d97..d5d8e5b 100644 --- a/framework/yii/log/Target.php +++ b/framework/yii/log/Target.php @@ -233,6 +233,6 @@ abstract class Target extends Component $text = var_export($text, true); } $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; - return date('Y/m/d H:i:s', $timestamp) . " [$ip] [$level] [$category] $text\n"; + return date('Y/m/d H:i:s', $timestamp) . " [$ip] [$level] [$category] $text"; } } From bd8f74cf120aed98a1b523491da9d0d9cbb5215e Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 28 Nov 2013 09:55:35 -0500 Subject: [PATCH 12/30] Refactored MessageInterface::send(). --- framework/yii/log/EmailTarget.php | 20 ++++++++++---------- framework/yii/mail/BaseMessage.php | 15 +++++---------- framework/yii/mail/MessageInterface.php | 4 +++- tests/unit/framework/mail/BaseMessageTest.php | 9 +-------- 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/framework/yii/log/EmailTarget.php b/framework/yii/log/EmailTarget.php index 69019e3..95234d2 100644 --- a/framework/yii/log/EmailTarget.php +++ b/framework/yii/log/EmailTarget.php @@ -60,21 +60,21 @@ class EmailTarget extends Target */ public function export() { - $message = $this->mail->compose(); - Yii::configure($message, $this->message); - $this->composeMessage($message); - $this->mail->send($message); + $messages = array_map([$this, 'formatMessage'], $this->messages); + $body = wordwrap(implode("\n", $messages), 70); + $this->composeMessage($body)->send($this->mail); } /** - * Composes the given mail message with body content. - * The default implementation fills the text body of the message with the log messages. - * @param \yii\mail\MessageInterface $message + * Composes a mail message with the given body content. + * @param string $body the body content + * @return \yii\mail\MessageInterface $message */ - protected function composeMessage($message) + protected function composeMessage($body) { - $messages = array_map([$this, 'formatMessage'], $this->messages); - $body = wordwrap(implode("\n", $messages), 70); + $message = $this->mail->compose(); + Yii::configure($message, $this->message); $message->setTextBody($body); + return $message; } } diff --git a/framework/yii/mail/BaseMessage.php b/framework/yii/mail/BaseMessage.php index 208840a..f95b4fb 100644 --- a/framework/yii/mail/BaseMessage.php +++ b/framework/yii/mail/BaseMessage.php @@ -26,19 +26,14 @@ use Yii; abstract class BaseMessage extends Object implements MessageInterface { /** - * @return MailerInterface the mailer component - */ - public function getMailer() - { - return Yii::$app->getComponent('mail'); - } - - /** * {@inheritdoc} */ - public function send() + public function send(MailerInterface $mailer = null) { - return $this->getMailer()->send($this); + if ($mailer === null) { + $mailer = Yii::$app->getMail(); + } + return $mailer->send($this); } /** diff --git a/framework/yii/mail/MessageInterface.php b/framework/yii/mail/MessageInterface.php index eba9064..d70d40f 100644 --- a/framework/yii/mail/MessageInterface.php +++ b/framework/yii/mail/MessageInterface.php @@ -204,9 +204,11 @@ interface MessageInterface /** * Sends this email message. + * @param MailerInterface $mailer the mailer that should be used to send this message. + * If null, the "mail" application component will be used instead. * @return boolean whether this message is sent successfully. */ - public function send(); + public function send(MailerInterface $mailer = null); /** * Returns string representation of this message. diff --git a/tests/unit/framework/mail/BaseMessageTest.php b/tests/unit/framework/mail/BaseMessageTest.php index 35fa549..e9ed49e 100644 --- a/tests/unit/framework/mail/BaseMessageTest.php +++ b/tests/unit/framework/mail/BaseMessageTest.php @@ -40,18 +40,11 @@ class BaseMessageTest extends TestCase // Tests : - public function testGetMailer() - { - $mailer = $this->getMailer(); - $message = $mailer->compose(); - $this->assertEquals($mailer, $message->getMailer()); - } - public function testSend() { $mailer = $this->getMailer(); $message = $mailer->compose(); - $message->send(); + $message->send($mailer); $this->assertEquals($message, $mailer->sentMessages[0], 'Unable to send message!'); } From 05272b71208bceaa83923e6b71841d39a41e0055 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 28 Nov 2013 12:34:10 -0500 Subject: [PATCH 13/30] doc fix. --- framework/yii/console/controllers/MigrateController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/console/controllers/MigrateController.php b/framework/yii/console/controllers/MigrateController.php index 0e36911..5651b9c 100644 --- a/framework/yii/console/controllers/MigrateController.php +++ b/framework/yii/console/controllers/MigrateController.php @@ -33,7 +33,7 @@ use yii\helpers\ArrayHelper; * * ~~~ * CREATE TABLE tbl_migration ( - * version varchar(255) PRIMARY KEY, + * version varchar(180) PRIMARY KEY, * apply_time integer * ) * ~~~ From 55e954b68244f0f2840c8a068f36e9a5353a45db Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 29 Nov 2013 03:31:19 +0400 Subject: [PATCH 14/30] Docs on using behaviors --- docs/guide/behaviors.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/guide/behaviors.md b/docs/guide/behaviors.md index 8a67270..b425fd3 100644 --- a/docs/guide/behaviors.md +++ b/docs/guide/behaviors.md @@ -1,4 +1,41 @@ Behaviors ========= -TDB \ No newline at end of file +A behavior (also knows as mixin) can be used to enhance the functionality of an existing component without modifying its +code. In particular, it can "inject" its own methods and properties into the component and make them directly accessible +via the component. It can also respond to the events triggered in the component and thus intercept the normal +code execution. Unlike PHP traits, behaviors could be attached to classes at runtime. + +Using behaviors +--------------- + +Behavior can be attached to any class that extends from `Component`. In order to do so you need to implement `behaviors` +method. Yii provides `AutoTimestamp` behavior that handles updating timestamp fields on saving active record model. + +```php +class User extends ActiveRecord +{ + // ... + + public function behaviors() + { + return [ + 'timestamp' => [ + 'class' => 'yii\behaviors\AutoTimestamp', + 'attributes' => [ + ActiveRecord::EVENT_BEFORE_INSERT => ['create_time', 'update_time'], + ActiveRecord::EVENT_BEFORE_UPDATE => 'update_time', + ], + ], + ]; + } +} +``` + +In the above `class` value is a string containing fully qualified behavior class name. All the other key-values are +assigned to corresponding properties of the class. + +Creating your own behaviors +--------------------------- + +TBD \ No newline at end of file From 1a7ce04bb53654ab7fd95724e7fba8fbd536ec0b Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 29 Nov 2013 03:49:56 +0400 Subject: [PATCH 15/30] Structure for console application docs --- docs/guide/console.md | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/docs/guide/console.md b/docs/guide/console.md index 055c206..86ba6d5 100644 --- a/docs/guide/console.md +++ b/docs/guide/console.md @@ -1,4 +1,39 @@ -Building console applications -============================= +Console applications +==================== -TDB \ No newline at end of file +Yii has full featured support of console. Console application structure in Yii is very similar to web application. It +consists of one or more [[\yii\console\Controller]] (often referred to as commands). Each has one or more actions. + +Usage +----- + +User executes controller action using the following syntax: + +``` +yii [--param1=value1 --param2 ...] +``` + +For example, `MigrationController::create` with `MigrationController::$migrationTable` set can be called from command +line like the following: + +``` +yii migreate/create --migrationTable=my_migration +``` + +Entry script +------------ + + +Configuration +------------- + +Creating your own console commands +---------------------------------- + +### Controller + +### Action + +### Parameters + +### Return codes \ No newline at end of file From 97a5a9d45f0f918c31d6a62e56420292659f7394 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 29 Nov 2013 04:16:29 +0400 Subject: [PATCH 16/30] More docs on performance --- docs/guide/performance.md | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/docs/guide/performance.md b/docs/guide/performance.md index 42aa042..9309c2c 100644 --- a/docs/guide/performance.md +++ b/docs/guide/performance.md @@ -28,9 +28,10 @@ logger may record additional debug information for every message being logged. ### Enabling PHP opcode cache Enabling the PHP opcode cache improves any PHP application performance and lowers -memory usage significantly. Yii is no exception. It was tested with -[APC PHP extension](http://php.net/manual/en/book.apc.php) that caches -and optimizes PHP intermediate code and avoids the time spent in parsing PHP +memory usage significantly. Yii is no exception. It was tested with both +[PHP 5.5 OPcache](http://php.net/manual/en/book.opcache.php) and +[APC PHP extension](http://php.net/manual/en/book.apc.php). Both cache +and optimize PHP intermediate code and avoid the time spent in parsing PHP scripts for every incoming request. ### Turning on ActiveRecord database schema caching @@ -69,7 +70,10 @@ Note that `cache` application component should be configured. ### Combining and Minimizing Assets -TBD +It is possible to combine and minimize assets, typically JavaScript and CSS, in order to slightly improve page load +time and therefore deliver better experience for end user of your application. + +In order to learn how it can be achieved, refer to [assets](assets.md) guide section. ### Using better storage for sessions @@ -118,7 +122,38 @@ save the rendering cost for the whole page. ### Leveraging HTTP to save processing time and bandwidth -TBD +Leveraging HTTP caching saves both processing time, bandwidth and resources significantly. It can be implemented by +sending either `ETag` or `Last-Modified` header in your application response. If browser is implemented according to +HTTP specification (most browsers are), content will be fetched only if it is different from what it was prevously. + +Forming proper headers is time consuming task so Yii provides a shortcut in form of controller filter +[[\yii\web\HttpCache]]. Using it is very easy. In a controller you need to implement `behaviors` method like +the following: + +```php +public function behaviors() +{ + return [ + 'httpCache' => [ + 'class' => \yii\web\HttpCache::className(), + 'only' => ['list'], + 'lastModified' => function ($action, $params) { + $q = new Query(); + return strtotime($q->from('users')->max('updated_timestamp')); + }, + // 'etagSeed' => function ($action, $params) { + // return // generate etag seed here + //} + ], + ]; +} +``` + +In the code above one can use either `etagSeed` or `lastModified`. Implementing both isn't necessary. The goal is to +determine if content was modified in a way that is cheaper than fetching and rendering that content. `lastModified` +should return unix timestamp of the last content modification while `etagSeed` should return a string that is then +used to generate `ETag` header value. + ### Database Optimization @@ -140,7 +175,7 @@ to create one or several objects to represent each row of query result. For data intensive applications, using DAO or database APIs at lower level could be a better choice. -Last but not least, use LIMIT in your SELECT queries. This avoids fetching +Last but not least, use `LIMIT` in your `SELECT` queries. This avoids fetching overwhelming data from database and exhausting the memory allocated to PHP. ### Using asArray From 2c7e9e45c9a4a644b8acf417901b8cb695e7b2b4 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 29 Nov 2013 04:17:11 +0400 Subject: [PATCH 17/30] Better docs structure and minor fixes --- docs/guide/database-basics.md | 5 +++-- docs/guide/debugger.md | 18 ++++++++++-------- docs/guide/gii.md | 12 ++++++------ docs/guide/i18n.md | 2 ++ 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/docs/guide/database-basics.md b/docs/guide/database-basics.md index 511ecaf..520da22 100644 --- a/docs/guide/database-basics.md +++ b/docs/guide/database-basics.md @@ -9,8 +9,8 @@ uniform API and solves some inconsistencies between different DBMS. By default Y - [SQLite](http://sqlite.org/) - [PostgreSQL](http://www.postgresql.org/) - [CUBRID](http://www.cubrid.org/) (version 9.1.0 and higher). -- Oracle -- MSSQL +- [Oracle](http://www.oracle.com/us/products/database/overview/index.html) +- [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx) Configuration @@ -42,6 +42,7 @@ return [ // ... ]; ``` + Please refer to the [PHP manual](http://www.php.net/manual/en/function.PDO-construct.php) for more details on the format of the DSN string. diff --git a/docs/guide/debugger.md b/docs/guide/debugger.md index 9006d9d..a49471a 100644 --- a/docs/guide/debugger.md +++ b/docs/guide/debugger.md @@ -7,19 +7,21 @@ about currently opened page while using debugger you can analyze data collected Installing and configuring -------------------------- -How to use it -------------- - Add these lines to your config file: ``` - 'preload' => ['debug'], - 'modules' => [ - 'debug' => ['yii\debug\Module'] - ] +'preload' => ['debug'], +'modules' => [ + 'debug' => ['yii\debug\Module'] +] ``` -**Watch out: by default the debug module only works when browsing the website from the localhost. If you want to use it on a remote (staging) server, add the parameter allowedIPs to the config to whitelist your IP.** +**Watch out: by default the debug module only works when browsing the website from the localhost. If you want to use it +on a remote (staging) server, add the parameter allowedIPs to the config to whitelist your IP.** + +How to use it +------------- + Creating your own panels ------------------------ diff --git a/docs/guide/gii.md b/docs/guide/gii.md index 54f6a36..525c567 100644 --- a/docs/guide/gii.md +++ b/docs/guide/gii.md @@ -7,17 +7,17 @@ as well as complete CRUD controllers. Installing and configuring -------------------------- -How to use it -------------- - Add these lines to your config file: ```php - 'modules' => [ - 'gii' => ['yii\gii\Module'] - ] +'modules' => [ + 'gii' => ['yii\gii\Module'] +] ``` +How to use it +------------- + Creating your own templates --------------------------- diff --git a/docs/guide/i18n.md b/docs/guide/i18n.md index 477de0a..3a538a0 100644 --- a/docs/guide/i18n.md +++ b/docs/guide/i18n.md @@ -264,3 +264,5 @@ Formatters In order to use formatters you need to install and enable [intl](http://www.php.net/manual/en/intro.intl.php) PHP extension. + +TBD: provided classes overview. \ No newline at end of file From b3de71a633623093aa743099dadecb649ee1fe18 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 29 Nov 2013 04:21:43 +0400 Subject: [PATCH 18/30] Added reference to Composer section of the guide from 1.1.x differences page --- docs/guide/upgrade-from-v1.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/guide/upgrade-from-v1.md b/docs/guide/upgrade-from-v1.md index c02a48d..d644190 100644 --- a/docs/guide/upgrade-from-v1.md +++ b/docs/guide/upgrade-from-v1.md @@ -518,5 +518,8 @@ TBD Integration with Composer ------------------------- -TBD +Yii is fully inegrated with the package manager for PHP named Composer that resolves dependencies, keeps your code +up to date updating it semi-automatically and manages autoloading for third party libraries no matter which autoloading +these are using. +In order to learn more refer to [composer](composer.md) and [installation](installation.md) sections of the guide. \ No newline at end of file From 9d57b40b6d2a9c71a662dacb1707d77b7b7fa6d1 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 29 Nov 2013 04:23:33 +0400 Subject: [PATCH 19/30] More TDB for the guide --- docs/guide/url.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/guide/url.md b/docs/guide/url.md index 454a827..2372ffd 100644 --- a/docs/guide/url.md +++ b/docs/guide/url.md @@ -92,6 +92,8 @@ return [ ### Handling REST +TBD: [[\yii\web\VerbFiler]] + URL parsing ----------- @@ -118,3 +120,5 @@ return [ Creating your own rule classes ------------------------------ + +TBD \ No newline at end of file From a1f7f8bcbed7c1d3c88b8e58ca7a6f016446138f Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 28 Nov 2013 23:58:14 -0500 Subject: [PATCH 20/30] Fixes #1335: support view extension fallback --- framework/yii/base/Controller.php | 10 +++++++--- framework/yii/base/View.php | 11 +++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/framework/yii/base/Controller.php b/framework/yii/base/Controller.php index 42a2efc..72eb0c8 100644 --- a/framework/yii/base/Controller.php +++ b/framework/yii/base/Controller.php @@ -417,9 +417,13 @@ class Controller extends Component implements ViewContextInterface $file = $module->getLayoutPath() . DIRECTORY_SEPARATOR . $layout; } - if (pathinfo($file, PATHINFO_EXTENSION) === '') { - $file .= $view->defaultExtension; + if (pathinfo($file, PATHINFO_EXTENSION) !== '') { + return $file; } - return $file; + $path = $file . '.' . $view->defaultExtension; + if ($view->defaultExtension !== 'php' && !is_file($path)) { + $path = $file . '.php'; + } + return $path; } } diff --git a/framework/yii/base/View.php b/framework/yii/base/View.php index fcfe31e..47650f0 100644 --- a/framework/yii/base/View.php +++ b/framework/yii/base/View.php @@ -67,7 +67,7 @@ class View extends Component /** * @var string the default view file extension. This will be appended to view file names if they don't have file extensions. */ - public $defaultExtension = '.php'; + public $defaultExtension = 'php'; /** * @var Theme|array the theme object or the configuration array for creating the theme object. * If not set, it means theming is not enabled. @@ -171,7 +171,14 @@ class View extends Component } } - return pathinfo($file, PATHINFO_EXTENSION) === '' ? $file . $this->defaultExtension : $file; + if (pathinfo($file, PATHINFO_EXTENSION) !== '') { + return $file; + } + $path = $file . '.' . $this->defaultExtension; + if ($this->defaultExtension !== 'php' && !is_file($path)) { + $path = $file . '.php'; + } + return $path; } /** From c4f7d024d9d0a6ca20dfdfbaafedf49a6b1cddbd Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 29 Nov 2013 00:25:45 -0500 Subject: [PATCH 21/30] typo fix. --- docs/guide/i18n.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guide/i18n.md b/docs/guide/i18n.md index 3a538a0..482b318 100644 --- a/docs/guide/i18n.md +++ b/docs/guide/i18n.md @@ -47,7 +47,7 @@ translation of the message from source language into target language. Message it echo \Yii::t('app', 'This is a string to translate!'); ``` -Yii tries to load approprite translation from one of the message sources defined via `i18n` component configuration: +Yii tries to load appropriate translation from one of the message sources defined via `i18n` component configuration: ```php 'components' => [ @@ -239,7 +239,7 @@ you'll get "Inconsistent types declared for an argument: U_ARGUMENT_TYPE_MISMATC Total {count, number} {count, plural, one{item} other{items}}. ``` -To learn which inflection forms you should specify for your language you can referer to +To learn which inflection forms you should specify for your language you can referrer to [rules reference at unicode.org](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html). ### Selections @@ -265,4 +265,4 @@ Formatters In order to use formatters you need to install and enable [intl](http://www.php.net/manual/en/intro.intl.php) PHP extension. -TBD: provided classes overview. \ No newline at end of file +TBD: provided classes overview. From d803b6f4093872857b3322ff09dec196731db610 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 29 Nov 2013 00:26:40 -0500 Subject: [PATCH 22/30] Fixes #1332: generate subdirectories when needed during message extraction process. --- framework/yii/console/controllers/MessageController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/framework/yii/console/controllers/MessageController.php b/framework/yii/console/controllers/MessageController.php index 8a0f10b..7ac1558 100644 --- a/framework/yii/console/controllers/MessageController.php +++ b/framework/yii/console/controllers/MessageController.php @@ -107,11 +107,13 @@ class MessageController extends Controller @mkdir($dir); } foreach ($messages as $category => $msgs) { + $file = str_replace("\\", '/', "$dir/$category.php"); + $path = dirname($file); + if (!is_dir($path)) { + mkdir($path, 0755, true); + } $msgs = array_values(array_unique($msgs)); - $this->generateMessageFile($msgs, $dir . DIRECTORY_SEPARATOR . $category . '.php', - $config['overwrite'], - $config['removeUnused'], - $config['sort']); + $this->generateMessageFile($msgs, $file, $config['overwrite'], $config['removeUnused'], $config['sort']); } } } From d4b88555fa7f00765dd61f849e6010e1df578c13 Mon Sep 17 00:00:00 2001 From: John Fragkoulis Date: Fri, 29 Nov 2013 10:17:11 +0200 Subject: [PATCH 23/30] really small doc typo fix --- framework/yii/assets/yii.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/yii/assets/yii.js b/framework/yii/assets/yii.js index add3a02..0aaf63a 100644 --- a/framework/yii/assets/yii.js +++ b/framework/yii/assets/yii.js @@ -53,14 +53,14 @@ yii = (function ($) { changeableSelector: 'select, input, textarea', /** - * @return string|undefined the CSRF variable name. Undefined is returned is CSRF validation is not enabled. + * @return string|undefined the CSRF variable name. Undefined is returned if CSRF validation is not enabled. */ getCsrfVar: function () { return $('meta[name=csrf-var]').prop('content'); }, /** - * @return string|undefined the CSRF token. Undefined is returned is CSRF validation is not enabled. + * @return string|undefined the CSRF token. Undefined is returned if CSRF validation is not enabled. */ getCsrfToken: function () { return $('meta[name=csrf-token]').prop('content'); From 8307075f749565bb469b5a9d567bbd5d53264f39 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 29 Nov 2013 11:34:34 -0500 Subject: [PATCH 24/30] Fixes #1362: doc fix. --- framework/yii/helpers/BaseHtml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/helpers/BaseHtml.php b/framework/yii/helpers/BaseHtml.php index 6f8e4e5..1017665 100644 --- a/framework/yii/helpers/BaseHtml.php +++ b/framework/yii/helpers/BaseHtml.php @@ -797,7 +797,7 @@ class BaseHtml * @param string $name the name attribute of each radio button. * @param string|array $selection the selected value(s). * @param array $items the data item used to generate the radio buttons. - * The array keys are the labels, while the array values are the corresponding radio button values. + * The array values are the labels, while the array keys are the corresponding radio button values. * @param array $options options (name => config) for the radio button list. The following options are supported: * * - unselect: string, the value that should be submitted when none of the radio buttons is selected. From a1612f5d7ecc8aff283fa5ad0bc1bda3bdef7626 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 29 Nov 2013 12:13:53 -0500 Subject: [PATCH 25/30] Fixes #1362: added itemOptions to Html::radioList and checkboxList. --- framework/yii/helpers/BaseHtml.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/framework/yii/helpers/BaseHtml.php b/framework/yii/helpers/BaseHtml.php index 1017665..d435d71 100644 --- a/framework/yii/helpers/BaseHtml.php +++ b/framework/yii/helpers/BaseHtml.php @@ -739,6 +739,7 @@ class BaseHtml * - encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. * This option is ignored if `item` option is set. * - separator: string, the HTML code that separates items. + * - itemOptions: array, the options for generating the radio button tag using [[checkbox()]]. * - item: callable, a callback that can be used to customize the generation of the HTML code * corresponding to a single item in $items. The signature of this callback must be: * @@ -758,6 +759,7 @@ class BaseHtml } $formatter = isset($options['item']) ? $options['item'] : null; + $itemOptions = isset($options['itemOptions']) ? $options['itemOptions'] : []; $encode = !isset($options['encode']) || $options['encode']; $lines = []; $index = 0; @@ -768,10 +770,10 @@ class BaseHtml if ($formatter !== null) { $lines[] = call_user_func($formatter, $index, $label, $name, $checked, $value); } else { - $lines[] = static::checkbox($name, $checked, [ + $lines[] = static::checkbox($name, $checked, array_merge($itemOptions, [ 'value' => $value, 'label' => $encode ? static::encode($label) : $label, - ]); + ])); } $index++; } @@ -786,7 +788,7 @@ class BaseHtml $separator = isset($options['separator']) ? $options['separator'] : "\n"; $tag = isset($options['tag']) ? $options['tag'] : 'div'; - unset($options['tag'], $options['unselect'], $options['encode'], $options['separator'], $options['item']); + unset($options['tag'], $options['unselect'], $options['encode'], $options['separator'], $options['item'], $options['itemOptions']); return $hidden . static::tag($tag, implode($separator, $lines), $options); } @@ -805,6 +807,7 @@ class BaseHtml * - encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. * This option is ignored if `item` option is set. * - separator: string, the HTML code that separates items. + * - itemOptions: array, the options for generating the radio button tag using [[radio()]]. * - item: callable, a callback that can be used to customize the generation of the HTML code * corresponding to a single item in $items. The signature of this callback must be: * @@ -821,6 +824,7 @@ class BaseHtml { $encode = !isset($options['encode']) || $options['encode']; $formatter = isset($options['item']) ? $options['item'] : null; + $itemOptions = isset($options['itemOptions']) ? $options['itemOptions'] : []; $lines = []; $index = 0; foreach ($items as $value => $label) { @@ -830,10 +834,10 @@ class BaseHtml if ($formatter !== null) { $lines[] = call_user_func($formatter, $index, $label, $name, $checked, $value); } else { - $lines[] = static::radio($name, $checked, [ + $lines[] = static::radio($name, $checked, array_merge($itemOptions, [ 'value' => $value, 'label' => $encode ? static::encode($label) : $label, - ]); + ])); } $index++; } @@ -847,7 +851,7 @@ class BaseHtml } $tag = isset($options['tag']) ? $options['tag'] : 'div'; - unset($options['tag'], $options['unselect'], $options['encode'], $options['separator'], $options['item']); + unset($options['tag'], $options['unselect'], $options['encode'], $options['separator'], $options['item'], $options['itemOptions']); return $hidden . static::tag($tag, implode($separator, $lines), $options); } From 323008b177e5e1606cf50d401f24dd4f9db7c7d7 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 29 Nov 2013 12:31:09 -0500 Subject: [PATCH 26/30] Fixes #1296: stricter check of dashes in route. --- framework/yii/base/Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/base/Controller.php b/framework/yii/base/Controller.php index 72eb0c8..d14c9dd 100644 --- a/framework/yii/base/Controller.php +++ b/framework/yii/base/Controller.php @@ -194,7 +194,7 @@ class Controller extends Component implements ViewContextInterface $actionMap = $this->actions(); if (isset($actionMap[$id])) { return Yii::createObject($actionMap[$id], $id, $this); - } elseif (preg_match('/^[a-z0-9\\-_]+$/', $id)) { + } elseif (preg_match('/^[a-z0-9\\-_]+$/', $id) && strpos($id, '--') === false && trim($id, '-') === $id) { $methodName = 'action' . str_replace(' ', '', ucwords(implode(' ', explode('-', $id)))); if (method_exists($this, $methodName)) { $method = new \ReflectionMethod($this, $methodName); From 975f263ef451f476cfc80d9dd76d5fa581c048e1 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 29 Nov 2013 12:35:17 -0500 Subject: [PATCH 27/30] Fixes #1356: Alias for authFile in rbac/PhpManager not resolved --- framework/yii/rbac/PhpManager.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/framework/yii/rbac/PhpManager.php b/framework/yii/rbac/PhpManager.php index 78e4d8c..3d02e4f 100644 --- a/framework/yii/rbac/PhpManager.php +++ b/framework/yii/rbac/PhpManager.php @@ -33,13 +33,12 @@ class PhpManager extends Manager { /** * @var string the path of the PHP script that contains the authorization data. - * If not set, it will be using 'protected/data/rbac.php' as the data file. - * Make sure this file is writable by the Web server process if the authorization - * needs to be changed. + * This can be either a file path or a path alias to the file. + * Make sure this file is writable by the Web server process if the authorization needs to be changed online. * @see loadFromFile() * @see saveToFile() */ - public $authFile; + public $authFile = '@app/data/rbac.php'; private $_items = []; // itemName => item private $_children = []; // itemName, childName => child @@ -53,9 +52,7 @@ class PhpManager extends Manager public function init() { parent::init(); - if ($this->authFile === null) { - $this->authFile = Yii::getAlias('@app/data/rbac') . '.php'; - } + $this->authFile = Yii::getAlias($this->authFile); $this->load(); } From c9e4773ebb949b810144374248b3b13e3da1bd30 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 29 Nov 2013 12:42:26 -0500 Subject: [PATCH 28/30] Moved key serialization from data provider to data viewers. --- framework/yii/data/ActiveDataProvider.php | 4 ++-- framework/yii/grid/GridView.php | 2 +- framework/yii/widgets/ListView.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/yii/data/ActiveDataProvider.php b/framework/yii/data/ActiveDataProvider.php index 0b3fc4a..6625bf5 100644 --- a/framework/yii/data/ActiveDataProvider.php +++ b/framework/yii/data/ActiveDataProvider.php @@ -138,9 +138,9 @@ class ActiveDataProvider extends BaseDataProvider foreach ($models as $model) { $kk = []; foreach ($pks as $pk) { - $kk[] = $model[$pk]; + $kk[$pk] = $model[$pk]; } - $keys[] = json_encode($kk); + $keys[] = $kk; } } return $keys; diff --git a/framework/yii/grid/GridView.php b/framework/yii/grid/GridView.php index de99a18..2510b83 100644 --- a/framework/yii/grid/GridView.php +++ b/framework/yii/grid/GridView.php @@ -373,7 +373,7 @@ class GridView extends BaseListView } else { $options = $this->rowOptions; } - $options['data-key'] = $key; + $options['data-key'] = is_array($key) ? json_encode($key) : $key; return Html::tag('tr', implode('', $cells), $options); } diff --git a/framework/yii/widgets/ListView.php b/framework/yii/widgets/ListView.php index ad13420..11d638c 100644 --- a/framework/yii/widgets/ListView.php +++ b/framework/yii/widgets/ListView.php @@ -88,7 +88,7 @@ class ListView extends BaseListView $options = $this->itemOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); if ($tag !== false) { - $options['data-key'] = $key; + $options['data-key'] = is_array($key) ? json_encode($key) : $key; return Html::tag($tag, $content, $options); } else { return $content; From fb3ebe70007dd16c3a14fe0c899d7c90d8ace58a Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 29 Nov 2013 12:47:10 -0500 Subject: [PATCH 29/30] doc cleanup. --- framework/yii/caching/WinCache.php | 2 +- framework/yii/db/Migration.php | 2 +- framework/yii/grid/CheckboxColumn.php | 2 +- framework/yii/grid/Column.php | 4 ++-- framework/yii/grid/GridView.php | 2 +- framework/yii/helpers/BaseConsole.php | 8 ++++---- framework/yii/widgets/FragmentCache.php | 2 +- .../unit/framework/console/controllers/MessageControllerTest.php | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/framework/yii/caching/WinCache.php b/framework/yii/caching/WinCache.php index 7f1eca8..6b80f3c 100644 --- a/framework/yii/caching/WinCache.php +++ b/framework/yii/caching/WinCache.php @@ -13,7 +13,7 @@ namespace yii\caching; * To use this application component, the [WinCache PHP extension](http://www.iis.net/expand/wincacheforphp) * must be loaded. Also note that "wincache.ucenabled" should be set to "On" in your php.ini file. * - * See {@link CCache} manual for common cache operations that are supported by WinCache. + * See [[Cache]] manual for common cache operations that are supported by WinCache. * * @author Qiang Xue * @since 2.0 diff --git a/framework/yii/db/Migration.php b/framework/yii/db/Migration.php index 37fdf3f..79a5abc 100644 --- a/framework/yii/db/Migration.php +++ b/framework/yii/db/Migration.php @@ -312,7 +312,7 @@ class Migration extends \yii\base\Component * Builds and executes a SQL statement for changing the definition of a column. * @param string $table the table whose column is to be changed. The table name will be properly quoted by the method. * @param string $column the name of the column to be changed. The name will be properly quoted by the method. - * @param string $type the new column type. The {@link getColumnType} method will be invoked to convert abstract column type (if any) + * @param string $type the new column type. The [[getColumnType()]] method will be invoked to convert abstract column type (if any) * into the physical one. Anything that is not recognized as abstract type will be kept in the generated SQL. * For example, 'string' will be turned into 'varchar(255)', while 'string not null' will become 'varchar(255) not null'. */ diff --git a/framework/yii/grid/CheckboxColumn.php b/framework/yii/grid/CheckboxColumn.php index d029648..23f7ed0 100644 --- a/framework/yii/grid/CheckboxColumn.php +++ b/framework/yii/grid/CheckboxColumn.php @@ -44,7 +44,7 @@ class CheckboxColumn extends Column /** * Renders the header cell content. - * The default implementation simply renders {@link header}. + * The default implementation simply renders [[header]]. * This method may be overridden to customize the rendering of the header cell. * @return string the rendering result */ diff --git a/framework/yii/grid/Column.php b/framework/yii/grid/Column.php index ec0c886..fa49147 100644 --- a/framework/yii/grid/Column.php +++ b/framework/yii/grid/Column.php @@ -94,7 +94,7 @@ class Column extends Object /** * Renders the header cell content. - * The default implementation simply renders {@link header}. + * The default implementation simply renders [[header]]. * This method may be overridden to customize the rendering of the header cell. * @return string the rendering result */ @@ -105,7 +105,7 @@ class Column extends Object /** * Renders the footer cell content. - * The default implementation simply renders {@link footer}. + * The default implementation simply renders [[footer]]. * This method may be overridden to customize the rendering of the footer cell. * @return string the rendering result */ diff --git a/framework/yii/grid/GridView.php b/framework/yii/grid/GridView.php index 2510b83..9e47017 100644 --- a/framework/yii/grid/GridView.php +++ b/framework/yii/grid/GridView.php @@ -162,7 +162,7 @@ class GridView extends BaseListView /** * Initializes the grid view. - * This method will initialize required property values and instantiate {@link columns} objects. + * This method will initialize required property values and instantiate [[columns]] objects. */ public function init() { diff --git a/framework/yii/helpers/BaseConsole.php b/framework/yii/helpers/BaseConsole.php index 480badf..92f7c46 100644 --- a/framework/yii/helpers/BaseConsole.php +++ b/framework/yii/helpers/BaseConsole.php @@ -142,7 +142,7 @@ class BaseConsole /** * Saves the current cursor position by sending ANSI control code SCP to the terminal. - * Position can then be restored with {@link restoreCursorPosition}. + * Position can then be restored with [[restoreCursorPosition()]]. */ public static function saveCursorPosition() { @@ -150,7 +150,7 @@ class BaseConsole } /** - * Restores the cursor position saved with {@link saveCursorPosition} by sending ANSI control code RCP to the terminal. + * Restores the cursor position saved with [[saveCursorPosition()]] by sending ANSI control code RCP to the terminal. */ public static function restoreCursorPosition() { @@ -159,7 +159,7 @@ class BaseConsole /** * Hides the cursor by sending ANSI DECTCEM code ?25l to the terminal. - * Use {@link showCursor} to bring it back. + * Use [[showCursor()]] to bring it back. * Do not forget to show cursor when your application exits. Cursor might stay hidden in terminal after exit. */ public static function hideCursor() @@ -168,7 +168,7 @@ class BaseConsole } /** - * Will show a cursor again when it has been hidden by {@link hideCursor} by sending ANSI DECTCEM code ?25h to the terminal. + * Will show a cursor again when it has been hidden by [[hideCursor()]] by sending ANSI DECTCEM code ?25h to the terminal. */ public static function showCursor() { diff --git a/framework/yii/widgets/FragmentCache.php b/framework/yii/widgets/FragmentCache.php index 3005df5..57c4659 100644 --- a/framework/yii/widgets/FragmentCache.php +++ b/framework/yii/widgets/FragmentCache.php @@ -94,7 +94,7 @@ class FragmentCache extends Widget /** * Marks the end of content to be cached. - * Content displayed before this method call and after {@link init()} + * Content displayed before this method call and after [[init()]] * will be captured and saved in cache. * This method does nothing if valid content is already found in cache. */ diff --git a/tests/unit/framework/console/controllers/MessageControllerTest.php b/tests/unit/framework/console/controllers/MessageControllerTest.php index 8bd2b12..465294f 100644 --- a/tests/unit/framework/console/controllers/MessageControllerTest.php +++ b/tests/unit/framework/console/controllers/MessageControllerTest.php @@ -108,7 +108,7 @@ class MessageControllerTest extends TestCase } /** - * Creates message command config file at {@link configFileName} + * Creates message command config file named as [[configFileName]]. * @param array $config message command config. */ protected function composeConfigFile(array $config) From a5e3c00d750b53eeeb0c0790fd65638a4e258bf7 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 29 Nov 2013 12:49:07 -0500 Subject: [PATCH 30/30] replaced inheritdoc tags. --- extensions/composer/Installer.php | 8 ++--- extensions/composer/Plugin.php | 2 +- extensions/elasticsearch/ActiveQuery.php | 6 ++-- extensions/elasticsearch/ActiveRecord.php | 18 +++++----- extensions/gii/Generator.php | 4 +-- extensions/gii/GiiAsset.php | 8 ++--- extensions/gii/Module.php | 6 ++-- extensions/gii/generators/controller/Generator.php | 20 +++++------ extensions/gii/generators/crud/Generator.php | 6 ++-- .../gii/generators/crud/templates/search.php | 2 +- extensions/gii/generators/form/Generator.php | 18 +++++----- extensions/gii/generators/model/Generator.php | 18 +++++----- .../gii/generators/model/templates/model.php | 6 ++-- extensions/gii/generators/module/Generator.php | 16 ++++----- extensions/redis/ActiveRecord.php | 10 +++--- extensions/redis/Cache.php | 14 ++++---- extensions/sphinx/ActiveQuery.php | 4 +-- extensions/sphinx/Command.php | 34 +++++++++--------- extensions/sphinx/Connection.php | 4 +-- extensions/swiftmailer/Mailer.php | 2 +- extensions/swiftmailer/Message.php | 42 +++++++++++----------- framework/yii/base/Application.php | 2 +- framework/yii/data/ActiveDataProvider.php | 8 ++--- framework/yii/data/ArrayDataProvider.php | 6 ++-- framework/yii/db/cubrid/QueryBuilder.php | 2 +- framework/yii/db/mysql/QueryBuilder.php | 2 +- framework/yii/db/sqlite/QueryBuilder.php | 2 +- framework/yii/mail/BaseMessage.php | 2 +- framework/yii/validators/SafeValidator.php | 2 +- framework/yii/validators/Validator.php | 2 +- framework/yii/web/Controller.php | 2 +- 31 files changed, 139 insertions(+), 139 deletions(-) diff --git a/extensions/composer/Installer.php b/extensions/composer/Installer.php index 164392e..d8d799f 100644 --- a/extensions/composer/Installer.php +++ b/extensions/composer/Installer.php @@ -26,7 +26,7 @@ class Installer extends LibraryInstaller const EXTENSION_FILE = 'yiisoft/extensions.php'; /** - * {@inheritdoc} + * @inheritdoc */ public function supports($packageType) { @@ -34,7 +34,7 @@ class Installer extends LibraryInstaller } /** - * {@inheritdoc} + * @inheritdoc */ public function install(InstalledRepositoryInterface $repo, PackageInterface $package) { @@ -49,7 +49,7 @@ class Installer extends LibraryInstaller } /** - * {@inheritdoc} + * @inheritdoc */ public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target) { @@ -63,7 +63,7 @@ class Installer extends LibraryInstaller } /** - * {@inheritdoc} + * @inheritdoc */ public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package) { diff --git a/extensions/composer/Plugin.php b/extensions/composer/Plugin.php index 40bd8e5..1111738 100644 --- a/extensions/composer/Plugin.php +++ b/extensions/composer/Plugin.php @@ -20,7 +20,7 @@ use Composer\Plugin\PluginInterface; class Plugin implements PluginInterface { /** - * {@inheritdoc} + * @inheritdoc */ public function activate(Composer $composer, IOInterface $io) { diff --git a/extensions/elasticsearch/ActiveQuery.php b/extensions/elasticsearch/ActiveQuery.php index b444f05..96d6681 100644 --- a/extensions/elasticsearch/ActiveQuery.php +++ b/extensions/elasticsearch/ActiveQuery.php @@ -139,7 +139,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface } /** - * {@inheritdoc} + * @inheritdoc */ public function search($db = null, $options = []) { @@ -161,7 +161,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface } /** - * {@inheritdoc} + * @inheritdoc */ public function scalar($field, $db = null) { @@ -177,7 +177,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface } /** - * {@inheritdoc} + * @inheritdoc */ public function column($field, $db = null) { diff --git a/extensions/elasticsearch/ActiveRecord.php b/extensions/elasticsearch/ActiveRecord.php index efdb5fe..b04e67d 100644 --- a/extensions/elasticsearch/ActiveRecord.php +++ b/extensions/elasticsearch/ActiveRecord.php @@ -61,7 +61,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public static function find($q = null) { @@ -138,7 +138,7 @@ class ActiveRecord extends \yii\db\ActiveRecord // TODO add percolate functionality http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html /** - * {@inheritdoc} + * @inheritdoc */ public static function createQuery() { @@ -146,7 +146,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public static function createActiveRelation($config = []) { @@ -175,7 +175,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public function getPrimaryKey($asArray = false) { @@ -187,7 +187,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public function getOldPrimaryKey($asArray = false) { @@ -430,7 +430,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public static function updateAllCounters($counters, $condition = null, $params = []) { @@ -438,7 +438,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public static function getTableSchema() { @@ -446,7 +446,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public static function tableName() { @@ -454,7 +454,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public static function findBySql($sql, $params = []) { diff --git a/extensions/gii/Generator.php b/extensions/gii/Generator.php index 53e54bb..05c45a7 100644 --- a/extensions/gii/Generator.php +++ b/extensions/gii/Generator.php @@ -63,7 +63,7 @@ abstract class Generator extends Model abstract public function generate(); /** - * {@inheritdoc} + * @inheritdoc */ public function init() { @@ -164,7 +164,7 @@ abstract class Generator extends Model } /** - * {@inheritdoc} + * @inheritdoc * * Child classes should override this method like the following so that the parent * rules are included: diff --git a/extensions/gii/GiiAsset.php b/extensions/gii/GiiAsset.php index 64dc62b..b100750 100644 --- a/extensions/gii/GiiAsset.php +++ b/extensions/gii/GiiAsset.php @@ -18,25 +18,25 @@ use yii\web\AssetBundle; class GiiAsset extends AssetBundle { /** - * {@inheritdoc} + * @inheritdoc */ public $sourcePath = '@yii/gii/assets'; /** - * {@inheritdoc} + * @inheritdoc */ public $css = [ 'main.css', 'typeahead.js-bootstrap.css', ]; /** - * {@inheritdoc} + * @inheritdoc */ public $js = [ 'gii.js', 'typeahead.js', ]; /** - * {@inheritdoc} + * @inheritdoc */ public $depends = [ 'yii\web\YiiAsset', diff --git a/extensions/gii/Module.php b/extensions/gii/Module.php index 5644e29..7dc9590 100644 --- a/extensions/gii/Module.php +++ b/extensions/gii/Module.php @@ -54,7 +54,7 @@ use yii\web\HttpException; class Module extends \yii\base\Module { /** - * {@inheritdoc} + * @inheritdoc */ public $controllerNamespace = 'yii\gii\controllers'; /** @@ -92,7 +92,7 @@ class Module extends \yii\base\Module /** - * {@inheritdoc} + * @inheritdoc */ public function init() { @@ -103,7 +103,7 @@ class Module extends \yii\base\Module } /** - * {@inheritdoc} + * @inheritdoc */ public function beforeAction($action) { diff --git a/extensions/gii/generators/controller/Generator.php b/extensions/gii/generators/controller/Generator.php index 769db0a..08b29d5 100644 --- a/extensions/gii/generators/controller/Generator.php +++ b/extensions/gii/generators/controller/Generator.php @@ -38,7 +38,7 @@ class Generator extends \yii\gii\Generator public $actions = 'index'; /** - * {@inheritdoc} + * @inheritdoc */ public function init() { @@ -47,7 +47,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function getName() { @@ -55,7 +55,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function getDescription() { @@ -64,7 +64,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function rules() { @@ -79,7 +79,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function attributeLabels() { @@ -92,7 +92,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function requiredTemplates() { @@ -103,7 +103,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function stickyAttributes() { @@ -111,7 +111,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function hints() { @@ -134,7 +134,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function successMessage() { @@ -149,7 +149,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function generate() { diff --git a/extensions/gii/generators/crud/Generator.php b/extensions/gii/generators/crud/Generator.php index 107c8f2..1925de2 100644 --- a/extensions/gii/generators/crud/Generator.php +++ b/extensions/gii/generators/crud/Generator.php @@ -69,7 +69,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function hints() { @@ -95,7 +95,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function stickyAttributes() { @@ -123,7 +123,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function generate() { diff --git a/extensions/gii/generators/crud/templates/search.php b/extensions/gii/generators/crud/templates/search.php index 17a0024..1411896 100644 --- a/extensions/gii/generators/crud/templates/search.php +++ b/extensions/gii/generators/crud/templates/search.php @@ -40,7 +40,7 @@ class extends Model } /** - * {@inheritdoc} + * @inheritdoc */ public function attributeLabels() { diff --git a/extensions/gii/generators/form/Generator.php b/extensions/gii/generators/form/Generator.php index cc4328e..3bc0be6 100644 --- a/extensions/gii/generators/form/Generator.php +++ b/extensions/gii/generators/form/Generator.php @@ -26,7 +26,7 @@ class Generator extends \yii\gii\Generator /** - * {@inheritdoc} + * @inheritdoc */ public function getName() { @@ -34,7 +34,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function getDescription() { @@ -42,7 +42,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function generate() { @@ -55,7 +55,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function rules() { @@ -72,7 +72,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function attributeLabels() { @@ -85,7 +85,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function requiredTemplates() { @@ -93,7 +93,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function stickyAttributes() { @@ -101,7 +101,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function hints() { @@ -114,7 +114,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function successMessage() { diff --git a/extensions/gii/generators/model/Generator.php b/extensions/gii/generators/model/Generator.php index 8c505f1..cd2fcbf 100644 --- a/extensions/gii/generators/model/Generator.php +++ b/extensions/gii/generators/model/Generator.php @@ -32,7 +32,7 @@ class Generator extends \yii\gii\Generator /** - * {@inheritdoc} + * @inheritdoc */ public function getName() { @@ -40,7 +40,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function getDescription() { @@ -48,7 +48,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function rules() { @@ -68,7 +68,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function attributeLabels() { @@ -84,7 +84,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function hints() { @@ -111,7 +111,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function autoCompleteData() { @@ -128,7 +128,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function requiredTemplates() { @@ -136,7 +136,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function stickyAttributes() { @@ -144,7 +144,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function generate() { diff --git a/extensions/gii/generators/model/templates/model.php b/extensions/gii/generators/model/templates/model.php index 555bee1..dcd1461 100644 --- a/extensions/gii/generators/model/templates/model.php +++ b/extensions/gii/generators/model/templates/model.php @@ -33,7 +33,7 @@ namespace ns ?>; class extends baseClass, '\\') . "\n" ?> { /** - * {@inheritdoc} + * @inheritdoc */ public static function tableName() { @@ -41,7 +41,7 @@ class extends baseClass, '\\') . } /** - * {@inheritdoc} + * @inheritdoc */ public function rules() { @@ -49,7 +49,7 @@ class extends baseClass, '\\') . } /** - * {@inheritdoc} + * @inheritdoc */ public function attributeLabels() { diff --git a/extensions/gii/generators/module/Generator.php b/extensions/gii/generators/module/Generator.php index a29555b..5946e07 100644 --- a/extensions/gii/generators/module/Generator.php +++ b/extensions/gii/generators/module/Generator.php @@ -24,7 +24,7 @@ class Generator extends \yii\gii\Generator public $moduleID; /** - * {@inheritdoc} + * @inheritdoc */ public function getName() { @@ -32,7 +32,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function getDescription() { @@ -40,7 +40,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function rules() { @@ -54,7 +54,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function attributeLabels() { @@ -65,7 +65,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function hints() { @@ -76,7 +76,7 @@ class Generator extends \yii\gii\Generator } /** - * {@inheritdoc} + * @inheritdoc */ public function successMessage() { @@ -104,7 +104,7 @@ EOD; } /** - * {@inheritdoc} + * @inheritdoc */ public function requiredTemplates() { @@ -112,7 +112,7 @@ EOD; } /** - * {@inheritdoc} + * @inheritdoc */ public function generate() { diff --git a/extensions/redis/ActiveRecord.php b/extensions/redis/ActiveRecord.php index 8c2933c..1239a6c 100644 --- a/extensions/redis/ActiveRecord.php +++ b/extensions/redis/ActiveRecord.php @@ -48,7 +48,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public static function createQuery() { @@ -56,7 +56,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public static function createActiveRelation($config = []) { @@ -87,7 +87,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public function insert($runValidation = true, $attributes = null) { @@ -294,7 +294,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public static function getTableSchema() { @@ -302,7 +302,7 @@ class ActiveRecord extends \yii\db\ActiveRecord } /** - * {@inheritdoc} + * @inheritdoc */ public static function findBySql($sql, $params = []) { diff --git a/extensions/redis/Cache.php b/extensions/redis/Cache.php index 627acdc..0722b9d 100644 --- a/extensions/redis/Cache.php +++ b/extensions/redis/Cache.php @@ -105,7 +105,7 @@ class Cache extends \yii\caching\Cache } /** - * {@inheritdoc} + * @inheritdoc */ protected function getValue($key) { @@ -113,7 +113,7 @@ class Cache extends \yii\caching\Cache } /** - * {@inheritdoc} + * @inheritdoc */ protected function getValues($keys) { @@ -127,7 +127,7 @@ class Cache extends \yii\caching\Cache } /** - * {@inheritdoc} + * @inheritdoc */ protected function setValue($key, $value, $expire) { @@ -140,7 +140,7 @@ class Cache extends \yii\caching\Cache } /** - * {@inheritdoc} + * @inheritdoc */ protected function setValues($data, $expire) { @@ -174,7 +174,7 @@ class Cache extends \yii\caching\Cache } /** - * {@inheritdoc} + * @inheritdoc */ protected function addValue($key, $value, $expire) { @@ -187,7 +187,7 @@ class Cache extends \yii\caching\Cache } /** - * {@inheritdoc} + * @inheritdoc */ protected function deleteValue($key) { @@ -195,7 +195,7 @@ class Cache extends \yii\caching\Cache } /** - * {@inheritdoc} + * @inheritdoc */ protected function flushValues() { diff --git a/extensions/sphinx/ActiveQuery.php b/extensions/sphinx/ActiveQuery.php index 7ba48d2..3533c35 100644 --- a/extensions/sphinx/ActiveQuery.php +++ b/extensions/sphinx/ActiveQuery.php @@ -176,7 +176,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface } /** - * {@inheritdoc} + * @inheritdoc */ protected function defaultConnection() { @@ -201,4 +201,4 @@ class ActiveQuery extends Query implements ActiveQueryInterface } return $result; } -} \ No newline at end of file +} diff --git a/extensions/sphinx/Command.php b/extensions/sphinx/Command.php index a6c8c4f..ba802f5 100644 --- a/extensions/sphinx/Command.php +++ b/extensions/sphinx/Command.php @@ -197,7 +197,7 @@ class Command extends \yii\db\Command // Not Supported : /** - * {@inheritdoc} + * @inheritdoc */ public function createTable($table, $columns, $options = null) { @@ -205,7 +205,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function renameTable($table, $newName) { @@ -213,7 +213,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function dropTable($table) { @@ -221,7 +221,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function truncateTable($table) { @@ -229,7 +229,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function addColumn($table, $column, $type) { @@ -237,7 +237,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function dropColumn($table, $column) { @@ -245,7 +245,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function renameColumn($table, $oldName, $newName) { @@ -253,7 +253,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function alterColumn($table, $column, $type) { @@ -261,7 +261,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function addPrimaryKey($name, $table, $columns) { @@ -269,7 +269,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function dropPrimaryKey($name, $table) { @@ -277,7 +277,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete = null, $update = null) { @@ -285,7 +285,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function dropForeignKey($name, $table) { @@ -293,7 +293,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function createIndex($name, $table, $columns, $unique = false) { @@ -301,7 +301,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function dropIndex($name, $table) { @@ -309,7 +309,7 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function resetSequence($table, $value = null) { @@ -317,10 +317,10 @@ class Command extends \yii\db\Command } /** - * {@inheritdoc} + * @inheritdoc */ public function checkIntegrity($check = true, $schema = '') { throw new NotSupportedException('"' . __METHOD__ . '" is not supported.'); } -} \ No newline at end of file +} diff --git a/extensions/sphinx/Connection.php b/extensions/sphinx/Connection.php index a3492bb..b6519d3 100644 --- a/extensions/sphinx/Connection.php +++ b/extensions/sphinx/Connection.php @@ -62,7 +62,7 @@ use yii\base\NotSupportedException; class Connection extends \yii\db\Connection { /** - * {@inheritdoc} + * @inheritdoc */ public $schemaMap = [ 'mysqli' => 'yii\sphinx\Schema', // MySQL @@ -129,4 +129,4 @@ class Connection extends \yii\db\Connection { throw new NotSupportedException('"' . __METHOD__ . '" is not supported.'); } -} \ No newline at end of file +} diff --git a/extensions/swiftmailer/Mailer.php b/extensions/swiftmailer/Mailer.php index aab8434..891f2b5 100644 --- a/extensions/swiftmailer/Mailer.php +++ b/extensions/swiftmailer/Mailer.php @@ -123,7 +123,7 @@ class Mailer extends BaseMailer } /** - * {@inheritdoc} + * @inheritdoc */ protected function sendMessage($message) { diff --git a/extensions/swiftmailer/Message.php b/extensions/swiftmailer/Message.php index f7d8b34..9558d58 100644 --- a/extensions/swiftmailer/Message.php +++ b/extensions/swiftmailer/Message.php @@ -41,7 +41,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function getCharset() { @@ -49,7 +49,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function setCharset($charset) { @@ -58,7 +58,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function getFrom() { @@ -66,7 +66,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function setFrom($from) { @@ -75,7 +75,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function getReplyTo() { @@ -83,7 +83,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function setReplyTo($replyTo) { @@ -92,7 +92,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function getTo() { @@ -100,7 +100,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function setTo($to) { @@ -109,7 +109,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function getCc() { @@ -117,7 +117,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function setCc($cc) { @@ -126,7 +126,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function getBcc() { @@ -134,7 +134,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function setBcc($bcc) { @@ -143,7 +143,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function getSubject() { @@ -151,7 +151,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function setSubject($subject) { @@ -160,7 +160,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function setTextBody($text) { @@ -169,7 +169,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function setHtmlBody($html) { @@ -222,7 +222,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function attach($fileName, array $options = []) { @@ -238,7 +238,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function attachContent($content, array $options = []) { @@ -254,7 +254,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function embed($fileName, array $options = []) { @@ -269,7 +269,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function embedContent($content, array $options = []) { @@ -284,7 +284,7 @@ class Message extends BaseMessage } /** - * {@inheritdoc} + * @inheritdoc */ public function toString() { diff --git a/framework/yii/base/Application.php b/framework/yii/base/Application.php index 48b526c..756d4e2 100644 --- a/framework/yii/base/Application.php +++ b/framework/yii/base/Application.php @@ -199,7 +199,7 @@ abstract class Application extends Module } /** - * {@inheritdoc} + * @inheritdoc */ public function init() { diff --git a/framework/yii/data/ActiveDataProvider.php b/framework/yii/data/ActiveDataProvider.php index 6625bf5..8c69230 100644 --- a/framework/yii/data/ActiveDataProvider.php +++ b/framework/yii/data/ActiveDataProvider.php @@ -93,7 +93,7 @@ class ActiveDataProvider extends BaseDataProvider } /** - * {@inheritdoc} + * @inheritdoc */ protected function prepareModels() { @@ -111,7 +111,7 @@ class ActiveDataProvider extends BaseDataProvider } /** - * {@inheritdoc} + * @inheritdoc */ protected function prepareKeys($models) { @@ -150,7 +150,7 @@ class ActiveDataProvider extends BaseDataProvider } /** - * {@inheritdoc} + * @inheritdoc */ protected function prepareTotalCount() { @@ -162,7 +162,7 @@ class ActiveDataProvider extends BaseDataProvider } /** - * {@inheritdoc} + * @inheritdoc */ public function setSort($value) { diff --git a/framework/yii/data/ArrayDataProvider.php b/framework/yii/data/ArrayDataProvider.php index 987e364..2b694c7 100644 --- a/framework/yii/data/ArrayDataProvider.php +++ b/framework/yii/data/ArrayDataProvider.php @@ -66,7 +66,7 @@ class ArrayDataProvider extends BaseDataProvider /** - * {@inheritdoc} + * @inheritdoc */ protected function prepareModels() { @@ -87,7 +87,7 @@ class ArrayDataProvider extends BaseDataProvider } /** - * {@inheritdoc} + * @inheritdoc */ protected function prepareKeys($models) { @@ -107,7 +107,7 @@ class ArrayDataProvider extends BaseDataProvider } /** - * {@inheritdoc} + * @inheritdoc */ protected function prepareTotalCount() { diff --git a/framework/yii/db/cubrid/QueryBuilder.php b/framework/yii/db/cubrid/QueryBuilder.php index 45bd4a2..9acf91f 100644 --- a/framework/yii/db/cubrid/QueryBuilder.php +++ b/framework/yii/db/cubrid/QueryBuilder.php @@ -69,7 +69,7 @@ class QueryBuilder extends \yii\db\QueryBuilder } /** - * {@inheritdoc} + * @inheritdoc */ public function buildLimit($limit, $offset) { diff --git a/framework/yii/db/mysql/QueryBuilder.php b/framework/yii/db/mysql/QueryBuilder.php index 9cb321f..e9481a4 100644 --- a/framework/yii/db/mysql/QueryBuilder.php +++ b/framework/yii/db/mysql/QueryBuilder.php @@ -142,7 +142,7 @@ class QueryBuilder extends \yii\db\QueryBuilder } /** - * {@inheritdoc} + * @inheritdoc */ public function buildLimit($limit, $offset) { diff --git a/framework/yii/db/sqlite/QueryBuilder.php b/framework/yii/db/sqlite/QueryBuilder.php index ae049e7..bddc436 100644 --- a/framework/yii/db/sqlite/QueryBuilder.php +++ b/framework/yii/db/sqlite/QueryBuilder.php @@ -255,7 +255,7 @@ class QueryBuilder extends \yii\db\QueryBuilder } /** - * {@inheritdoc} + * @inheritdoc */ public function buildLimit($limit, $offset) { diff --git a/framework/yii/mail/BaseMessage.php b/framework/yii/mail/BaseMessage.php index f95b4fb..c23f96a 100644 --- a/framework/yii/mail/BaseMessage.php +++ b/framework/yii/mail/BaseMessage.php @@ -26,7 +26,7 @@ use Yii; abstract class BaseMessage extends Object implements MessageInterface { /** - * {@inheritdoc} + * @inheritdoc */ public function send(MailerInterface $mailer = null) { diff --git a/framework/yii/validators/SafeValidator.php b/framework/yii/validators/SafeValidator.php index 7cdc0a1..25da899 100644 --- a/framework/yii/validators/SafeValidator.php +++ b/framework/yii/validators/SafeValidator.php @@ -16,7 +16,7 @@ namespace yii\validators; class SafeValidator extends Validator { /** - * {@inheritdoc} + * @inheritdoc */ public function validateAttribute($object, $attribute) { diff --git a/framework/yii/validators/Validator.php b/framework/yii/validators/Validator.php index f0602b6..2cd611b 100644 --- a/framework/yii/validators/Validator.php +++ b/framework/yii/validators/Validator.php @@ -159,7 +159,7 @@ abstract class Validator extends Component } /** - * {@inheritdoc} + * @inheritdoc */ public function init() { diff --git a/framework/yii/web/Controller.php b/framework/yii/web/Controller.php index 1424d0c..e01a924 100644 --- a/framework/yii/web/Controller.php +++ b/framework/yii/web/Controller.php @@ -86,7 +86,7 @@ class Controller extends \yii\base\Controller } /** - * {@inheritdoc} + * @inheritdoc */ public function beforeAction($action) {