diff --git a/.coveralls.yml b/.coveralls.yml
deleted file mode 100644
index c0564c2..0000000
--- a/.coveralls.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-service_name: travis-ci
-src_dir: framework/yii
-coverage_clover: tests/unit/runtime/coveralls/clover.xml
-json_path: tests/unit/runtime/coveralls/coveralls-upload.json
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 818cb6a..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,23 +0,0 @@
-# Autodetect text files
-* text=auto
-
-# ...Unless the name matches the following overriding patterns
-
-# Definitively text files
-*.php text
-*.css text
-*.js text
-*.txt text
-*.md text
-*.xml text
-*.json text
-*.bat text
-*.sql text
-*.xml text
-*.yml text
-
-# Ensure those won't be messed up with
-*.png binary
-*.jpg binary
-*.gif binary
-*.ttf binary
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index e3fdcbf..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,29 +0,0 @@
-# phpstorm project files
-.idea
-
-# netbeans project files
-nbproject
-
-# zend studio for eclipse project files
-.buildpath
-.project
-.settings
-
-# windows thumbnail cache
-Thumbs.db
-
-# composer vendor dir
-/vendor
-
-# composer itself is not needed
-composer.phar
-# composer.lock should not be committed as we always want the latest versions
-/composer.lock
-
-# Mac DS_Store Files
-.DS_Store
-
-# phpunit itself is not needed
-phpunit.phar
-# local phpunit config
-/phpunit.xml
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 8134e21..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-language: php
-
-php:
- - 5.4
- - 5.5
-# - hhvm # commented until composer or hhvm get fixed: https://github.com/facebook/hhvm/issues/1347
-
-services:
- - redis-server
- - memcached
- - elasticsearch
- - mongodb
-
-install:
- - composer self-update && composer --version
-# core framework:
-# - composer require satooshi/php-coveralls 0.6.* --dev --prefer-dist
- - composer install --prefer-dist
- - tests/unit/data/travis/mongodb-setup.sh
- - tests/unit/data/travis/apc-setup.sh
- - tests/unit/data/travis/memcache-setup.sh
- - tests/unit/data/travis/cubrid-setup.sh
-# basic application:
- - composer install --dev --prefer-dist -d apps/basic
- - cd apps/basic && php vendor/bin/codecept build && cd ../..
- - cd apps && php -S localhost:8080 &
-
-before_script:
- - echo 'elasticsearch version ' && curl http://localhost:9200/
- - mysql -e 'CREATE DATABASE yiitest;';
- - psql -U postgres -c 'CREATE DATABASE yiitest;';
- - tests/unit/data/travis/sphinx-setup.sh
- - mongo yii2test --eval 'db.addUser("travis", "test");'
-
-script:
-# - vendor/bin/phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor
- - vendor/bin/phpunit --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor
- - cd apps/basic && php vendor/bin/codecept run
-
-#after_script:
-# - php vendor/bin/coveralls
diff --git a/extensions/yii/bootstrap/Alert.php b/Alert.php
similarity index 100%
rename from extensions/yii/bootstrap/Alert.php
rename to Alert.php
diff --git a/extensions/yii/bootstrap/BootstrapAsset.php b/BootstrapAsset.php
similarity index 100%
rename from extensions/yii/bootstrap/BootstrapAsset.php
rename to BootstrapAsset.php
diff --git a/extensions/yii/bootstrap/BootstrapPluginAsset.php b/BootstrapPluginAsset.php
similarity index 100%
rename from extensions/yii/bootstrap/BootstrapPluginAsset.php
rename to BootstrapPluginAsset.php
diff --git a/extensions/yii/bootstrap/BootstrapThemeAsset.php b/BootstrapThemeAsset.php
similarity index 100%
rename from extensions/yii/bootstrap/BootstrapThemeAsset.php
rename to BootstrapThemeAsset.php
diff --git a/extensions/yii/bootstrap/Button.php b/Button.php
similarity index 100%
rename from extensions/yii/bootstrap/Button.php
rename to Button.php
diff --git a/extensions/yii/bootstrap/ButtonDropdown.php b/ButtonDropdown.php
similarity index 100%
rename from extensions/yii/bootstrap/ButtonDropdown.php
rename to ButtonDropdown.php
diff --git a/extensions/yii/bootstrap/ButtonGroup.php b/ButtonGroup.php
similarity index 100%
rename from extensions/yii/bootstrap/ButtonGroup.php
rename to ButtonGroup.php
diff --git a/extensions/yii/bootstrap/CHANGELOG.md b/CHANGELOG.md
similarity index 100%
rename from extensions/yii/bootstrap/CHANGELOG.md
rename to CHANGELOG.md
diff --git a/extensions/yii/bootstrap/Carousel.php b/Carousel.php
similarity index 100%
rename from extensions/yii/bootstrap/Carousel.php
rename to Carousel.php
diff --git a/extensions/yii/bootstrap/Collapse.php b/Collapse.php
similarity index 100%
rename from extensions/yii/bootstrap/Collapse.php
rename to Collapse.php
diff --git a/extensions/yii/bootstrap/Dropdown.php b/Dropdown.php
similarity index 100%
rename from extensions/yii/bootstrap/Dropdown.php
rename to Dropdown.php
diff --git a/LICENSE.md b/LICENSE.md
deleted file mode 100644
index e98f03d..0000000
--- a/LICENSE.md
+++ /dev/null
@@ -1,32 +0,0 @@
-The Yii framework is free software. It is released under the terms of
-the following BSD License.
-
-Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of Yii Software LLC nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/extensions/yii/bootstrap/Modal.php b/Modal.php
similarity index 100%
rename from extensions/yii/bootstrap/Modal.php
rename to Modal.php
diff --git a/extensions/yii/bootstrap/Nav.php b/Nav.php
similarity index 100%
rename from extensions/yii/bootstrap/Nav.php
rename to Nav.php
diff --git a/extensions/yii/bootstrap/NavBar.php b/NavBar.php
similarity index 100%
rename from extensions/yii/bootstrap/NavBar.php
rename to NavBar.php
diff --git a/extensions/yii/bootstrap/Progress.php b/Progress.php
similarity index 100%
rename from extensions/yii/bootstrap/Progress.php
rename to Progress.php
diff --git a/README.md b/README.md
index d7020d9..bffc715 100644
--- a/README.md
+++ b/README.md
@@ -1,70 +1,32 @@
-Yii PHP Framework Version 2
-===========================
+Twitter Bootstrap Extension for Yii 2
+=====================================
-Thank you for choosing Yii 2 - a modern PHP framework designed for professional Web development.
+This is the Twitter Bootstrap extension for Yii 2. It encapsulates Bootstrap components
+and plugins in terms of Yii widgets, and thus makes using Bootstrap components/plugins
+in Yii applications extremely easy. For example, the following
+single line of code in a view file would render a Bootstrap Progress plugin:
-Yii 2 is a complete rewrite of its previous version Yii 1.1 which is one of the most popular PHP frameworks.
-Yii 2 inherits the main spirit behind Yii for being simple, fast and highly extensible.
-Yii 2 requires PHP 5.4 and embraces best practices and protocols found in modern Web application development.
+```php
+= yii\bootstrap\Progress::widget(['percent' => 60, 'label' => 'test']) ?>
+```
-**Yii 2 is not ready for production use yet.** We may make significant changes without prior notices.
-We expect to make the first stable release of Yii 2 in early 2014.
-
-If you mainly want to learn Yii with no real project development requirement, we highly recommend
-you start with Yii 2 as it will be our main focus for the next few years.
-
-If you have a real project with tight schedule, you should stick to [Yii 1.1](https://github.com/yiisoft/yii)
-which is the latest stable release of Yii.
-
-
-[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2/v/stable.png)](https://packagist.org/packages/yiisoft/yii2)
-[![Total Downloads](https://poser.pugx.org/yiisoft/yii2/downloads.png)](https://packagist.org/packages/yiisoft/yii2)
-[![Build Status](https://secure.travis-ci.org/yiisoft/yii2.png)](http://travis-ci.org/yiisoft/yii2)
-[![Dependency Status](https://www.versioneye.com/php/yiisoft:yii2/dev-master/badge.png)](https://www.versioneye.com/php/yiisoft:yii2/dev-master)
-
-
-DIRECTORY STRUCTURE
--------------------
-
- apps/ ready-to-use application templates
- advanced/ a template suitable for building sophisticated Web applications
- basic/ a template suitable for building simple Web applications
- benchmark/ an application demonstrating the performance of Yii
- build/ internally used build tools
- docs/ documentation
- extensions/ extensions
- framework/ core framework code
- tests/ tests of the core framework code
-
-
-REQUIREMENTS
+Installation
------------
-The minimum requirement by Yii is that your Web server supports PHP 5.4.
-
-
-DOCUMENTATION
--------------
-
-A draft of the [Definitive Guide](docs/guide/index.md) is available.
-
-For 1.1 users, you may refer to [Upgrading from Yii 1.1](docs/guide/upgrade-from-v1.md)
-to have a general idea of what has changed in 2.0.
-
+The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
-HOW TO PARTICIPATE
-------------------
+Either run
-**Your participation to Yii 2 development is very welcome!**
+```
+php composer.phar require --prefer-dist yiisoft/yii2-bootstrap "*"
+```
-You may participate in the following ways:
+or add
-* [Report issues](https://github.com/yiisoft/yii2/issues)
-* [Give us feedback or start a design discussion](http://www.yiiframework.com/forum/index.php/forum/42-design-discussions-for-yii-20/)
-* Fix issues, develop features, write/polish documentation
- - Before you start, please adopt an existing issue (labelled with "ready for adoption") or start a new one to avoid duplicated efforts.
- - Please submit a merge request after you finish development.
+```
+"yiisoft/yii2-bootstrap": "*"
+```
-In order to make it easier we've prepared [special `yii2-dev` Composer package](https://github.com/yiisoft/yii2/blob/master/docs/internals/getting-started.md).
+to the require section of your `composer.json` file.
diff --git a/extensions/yii/bootstrap/Tabs.php b/Tabs.php
similarity index 100%
rename from extensions/yii/bootstrap/Tabs.php
rename to Tabs.php
diff --git a/extensions/yii/bootstrap/Widget.php b/Widget.php
similarity index 100%
rename from extensions/yii/bootstrap/Widget.php
rename to Widget.php
diff --git a/apps/advanced/.gitignore b/apps/advanced/.gitignore
deleted file mode 100644
index 447bcd3..0000000
--- a/apps/advanced/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/yii
diff --git a/apps/advanced/LICENSE.md b/apps/advanced/LICENSE.md
deleted file mode 100644
index e98f03d..0000000
--- a/apps/advanced/LICENSE.md
+++ /dev/null
@@ -1,32 +0,0 @@
-The Yii framework is free software. It is released under the terms of
-the following BSD License.
-
-Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of Yii Software LLC nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/apps/advanced/README.md b/apps/advanced/README.md
deleted file mode 100644
index a1f79aa..0000000
--- a/apps/advanced/README.md
+++ /dev/null
@@ -1,89 +0,0 @@
-Yii 2 Advanced Application Template
-===================================
-
-Yii 2 Advanced Application Template is a skeleton Yii 2 application best for
-developing complex Web applications with multiple tiers.
-
-The template includes three tiers: front end, back end, and console, each of which
-is a separate Yii application.
-
-The template is designed to work in a team development environment. It supports
-deploying the application in different environments.
-
-
-DIRECTORY STRUCTURE
--------------------
-
-```
-common
- config/ contains shared configurations
- models/ contains model classes used in both backend and frontend
-console
- config/ contains console configurations
- controllers/ contains console controllers (commands)
- migrations/ contains database migrations
- models/ contains console-specific model classes
- runtime/ contains files generated during runtime
-backend
- assets/ contains application assets such as JavaScript and CSS
- config/ contains backend configurations
- controllers/ contains Web controller classes
- models/ contains backend-specific model classes
- runtime/ contains files generated during runtime
- views/ contains view files for the Web application
- web/ contains the entry script and Web resources
-frontend
- assets/ contains application assets such as JavaScript and CSS
- config/ contains frontend configurations
- controllers/ contains Web controller classes
- models/ contains frontend-specific model classes
- runtime/ contains files generated during runtime
- views/ contains view files for the Web application
- web/ contains the entry script and Web resources
-vendor/ contains dependent 3rd-party packages
-environments/ contains environment-based overrides
-```
-
-
-REQUIREMENTS
-------------
-
-The minimum requirement by this application template that your Web server supports PHP 5.4.0.
-
-
-INSTALLATION
-------------
-
-### Install from an Archive File
-
-Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to
-a directory named `advanced` that is directly under the Web root.
-
-Then follow the instructions given in "GETTING STARTED".
-
-
-### Install via Composer
-
-If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions
-at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix).
-
-You can then install the application using the following command:
-
-~~~
-php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced advanced
-~~~
-
-
-GETTING STARTED
----------------
-
-After you install the application, you have to conduct the following steps to initialize
-the installed application. You only need to do these once for all.
-
-1. Run command `init` to initialize the application with a specific environment.
-2. Create a new database and adjust the `components.db` configuration in `common/config/params-local.php` accordingly.
-3. Apply migrations with console command `yii migrate`.
-4. Set document roots of your Web server:
-
-- for frontend `/path/to/yii-application/frontend/web/` and using the URL `http://frontend/`
-- for backend `/path/to/yii-application/backend/web/` and using the URL `http://backend/`
diff --git a/apps/advanced/backend/assets/AppAsset.php b/apps/advanced/backend/assets/AppAsset.php
deleted file mode 100644
index bd5c3a0..0000000
--- a/apps/advanced/backend/assets/AppAsset.php
+++ /dev/null
@@ -1,26 +0,0 @@
-
- * @since 2.0
- */
-class AppAsset extends AssetBundle
-{
- public $basePath = '@webroot';
- public $baseUrl = '@web';
- public $css = ['css/site.css'];
- public $js = [];
- public $depends = [
- 'yii\web\YiiAsset',
- 'yii\bootstrap\BootstrapAsset',
- ];
-}
diff --git a/apps/advanced/backend/config/.gitignore b/apps/advanced/backend/config/.gitignore
deleted file mode 100644
index 20da318..0000000
--- a/apps/advanced/backend/config/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-main-local.php
-params-local.php
\ No newline at end of file
diff --git a/apps/advanced/backend/config/main.php b/apps/advanced/backend/config/main.php
deleted file mode 100644
index d1a45a7..0000000
--- a/apps/advanced/backend/config/main.php
+++ /dev/null
@@ -1,41 +0,0 @@
- 'app-backend',
- 'basePath' => dirname(__DIR__),
- 'vendorPath' => $rootDir . '/vendor',
- 'preload' => ['log'],
- 'controllerNamespace' => 'backend\controllers',
- 'modules' => [],
- 'extensions' => require($rootDir . '/vendor/yiisoft/extensions.php'),
- 'components' => [
- 'db' => $params['components.db'],
- 'cache' => $params['components.cache'],
- 'mail' => $params['components.mail'],
- 'user' => [
- 'identityClass' => 'common\models\User',
- 'enableAutoLogin' => true,
- ],
- 'log' => [
- 'traceLevel' => YII_DEBUG ? 3 : 0,
- 'targets' => [
- [
- 'class' => 'yii\log\FileTarget',
- 'levels' => ['error', 'warning'],
- ],
- ],
- ],
- 'errorHandler' => [
- 'errorAction' => 'site/error',
- ],
- ],
- 'params' => $params,
-];
diff --git a/apps/advanced/backend/config/params.php b/apps/advanced/backend/config/params.php
deleted file mode 100644
index 0e625dc..0000000
--- a/apps/advanced/backend/config/params.php
+++ /dev/null
@@ -1,4 +0,0 @@
- 'admin@example.com',
-];
diff --git a/apps/advanced/backend/controllers/SiteController.php b/apps/advanced/backend/controllers/SiteController.php
deleted file mode 100644
index ecf684c..0000000
--- a/apps/advanced/backend/controllers/SiteController.php
+++ /dev/null
@@ -1,66 +0,0 @@
- [
- 'class' => \yii\web\AccessControl::className(),
- 'rules' => [
- [
- 'actions' => ['login', 'error'],
- 'allow' => true,
- ],
- [
- 'actions' => ['logout', 'index'],
- 'allow' => true,
- 'roles' => ['@'],
- ],
- ],
- ],
- ];
- }
-
- public function actions()
- {
- return [
- 'error' => [
- 'class' => 'yii\web\ErrorAction',
- ],
- ];
- }
-
- public function actionIndex()
- {
- return $this->render('index');
- }
-
- public function actionLogin()
- {
- if (!\Yii::$app->user->isGuest) {
- $this->goHome();
- }
-
- $model = new LoginForm();
- if ($model->load($_POST) && $model->login()) {
- return $this->goBack();
- } else {
- return $this->render('login', [
- 'model' => $model,
- ]);
- }
- }
-
- public function actionLogout()
- {
- Yii::$app->user->logout();
- return $this->goHome();
- }
-}
diff --git a/apps/advanced/backend/models/.gitkeep b/apps/advanced/backend/models/.gitkeep
deleted file mode 100644
index 72e8ffc..0000000
--- a/apps/advanced/backend/models/.gitkeep
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/apps/advanced/backend/runtime/.gitignore b/apps/advanced/backend/runtime/.gitignore
deleted file mode 100644
index c96a04f..0000000
--- a/apps/advanced/backend/runtime/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/advanced/backend/views/layouts/main.php b/apps/advanced/backend/views/layouts/main.php
deleted file mode 100644
index d1ede45..0000000
--- a/apps/advanced/backend/views/layouts/main.php
+++ /dev/null
@@ -1,65 +0,0 @@
-
-beginPage() ?>
-
-
-
-
-
- = Html::encode($this->title) ?>
- head() ?>
-
-
- beginBody() ?>
- 'My Company',
- 'brandUrl' => Yii::$app->homeUrl,
- 'options' => [
- 'class' => 'navbar-inverse navbar-fixed-top',
- ],
- ]);
- $menuItems = [
- ['label' => 'Home', 'url' => ['/site/index']],
- ];
- if (Yii::$app->user->isGuest) {
- $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
- } else {
- $menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => ['/site/logout']];
- }
- echo Nav::widget([
- 'options' => ['class' => 'navbar-nav navbar-right'],
- 'items' => $menuItems,
- ]);
- NavBar::end();
- ?>
-
-
- = Breadcrumbs::widget([
- 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
- ]) ?>
- = $content ?>
-
-
-
-
- endBody() ?>
-
-
-endPage() ?>
diff --git a/apps/advanced/backend/views/site/error.php b/apps/advanced/backend/views/site/error.php
deleted file mode 100644
index 1b7ce04..0000000
--- a/apps/advanced/backend/views/site/error.php
+++ /dev/null
@@ -1,29 +0,0 @@
-title = $name;
-?>
-
-
-
= Html::encode($this->title) ?>
-
-
- = nl2br(Html::encode($message)) ?>
-
-
-
- The above error occurred while the Web server was processing your request.
-
-
- Please contact us if you think this is a server error. Thank you.
-
-
-
diff --git a/apps/advanced/backend/views/site/index.php b/apps/advanced/backend/views/site/index.php
deleted file mode 100644
index bcb2278..0000000
--- a/apps/advanced/backend/views/site/index.php
+++ /dev/null
@@ -1,53 +0,0 @@
-title = 'My Yii Application';
-?>
-
-
-
-
Congratulations!
-
-
You have successfully created your Yii-powered application.
-
-
Get started with Yii
-
-
-
-
-
-
-
Heading
-
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
- dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
- ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
- fugiat nulla pariatur.
-
-
Yii Documentation »
-
-
-
Heading
-
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
- dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
- ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
- fugiat nulla pariatur.
-
-
Yii Forum »
-
-
-
Heading
-
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
- dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
- ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
- fugiat nulla pariatur.
-
-
Yii Extensions »
-
-
-
-
-
diff --git a/apps/advanced/backend/views/site/login.php b/apps/advanced/backend/views/site/login.php
deleted file mode 100644
index 41973e5..0000000
--- a/apps/advanced/backend/views/site/login.php
+++ /dev/null
@@ -1,30 +0,0 @@
-title = 'Login';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-
-
= Html::encode($this->title) ?>
-
-
Please fill out the following fields to login:
-
-
-
- 'login-form']); ?>
- = $form->field($model, 'username') ?>
- = $form->field($model, 'password')->passwordInput() ?>
- = $form->field($model, 'rememberMe')->checkbox() ?>
-
- = Html::submitButton('Login', ['class' => 'btn btn-primary']) ?>
-
-
-
-
-
diff --git a/apps/advanced/backend/web/.gitignore b/apps/advanced/backend/web/.gitignore
deleted file mode 100644
index 148f2b0..0000000
--- a/apps/advanced/backend/web/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/index.php
\ No newline at end of file
diff --git a/apps/advanced/backend/web/assets/.gitignore b/apps/advanced/backend/web/assets/.gitignore
deleted file mode 100644
index c96a04f..0000000
--- a/apps/advanced/backend/web/assets/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/advanced/backend/web/css/site.css b/apps/advanced/backend/web/css/site.css
deleted file mode 100644
index a8508c4..0000000
--- a/apps/advanced/backend/web/css/site.css
+++ /dev/null
@@ -1,79 +0,0 @@
-body {
- padding-top: 70px;
-}
-
-.footer {
- border-top: 1px solid #ddd;
- margin-top: 30px;
- padding-top: 15px;
- padding-bottom: 30px;
-}
-
-.jumbotron {
- text-align: center;
- background-color: transparent;
-}
-
-.jumbotron .btn {
- font-size: 21px;
- padding: 14px 24px;
-}
-
-.not-set {
- color: #c55;
- font-style: italic;
-}
-
-/* add sorting icons to gridview sort links */
-a.asc:after, a.desc:after {
- position: relative;
- top: 1px;
- display: inline-block;
- font-family: 'Glyphicons Halflings';
- font-style: normal;
- font-weight: normal;
- line-height: 1;
- padding-left: 5px;
-}
-
-a.asc:after {
- content: /*"\e113"*/ "\e151";
-}
-
-a.desc:after {
- content: /*"\e114"*/ "\e152";
-}
-
-.sort-numerical a.asc:after {
- content: "\e153";
-}
-
-.sort-numerical a.desc:after {
- content: "\e154";
-}
-
-.sort-ordinal a.asc:after {
- content: "\e155";
-}
-
-.sort-ordinal a.desc:after {
- content: "\e156";
-}
-
-.grid-view th {
- white-space: nowrap;
-}
-
-.hint-block {
- display: block;
- margin-top: 5px;
- color: #999;
-}
-
-.error-summary {
- color: #a94442;
- background: #fdf7f7;
- border-left: 3px solid #eed3d7;
- padding: 10px 20px;
- margin: 0 0 15px 0;
-}
diff --git a/apps/advanced/backend/web/favicon.ico b/apps/advanced/backend/web/favicon.ico
deleted file mode 100644
index 49e61e3..0000000
Binary files a/apps/advanced/backend/web/favicon.ico and /dev/null differ
diff --git a/apps/advanced/backend/web/robots.txt b/apps/advanced/backend/web/robots.txt
deleted file mode 100644
index c6742d8..0000000
--- a/apps/advanced/backend/web/robots.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-User-Agent: *
-Disallow: /
diff --git a/apps/advanced/common/config/.gitignore b/apps/advanced/common/config/.gitignore
deleted file mode 100644
index 46f6eb4..0000000
--- a/apps/advanced/common/config/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-params-local.php
\ No newline at end of file
diff --git a/apps/advanced/common/config/params.php b/apps/advanced/common/config/params.php
deleted file mode 100644
index a3d3b3a..0000000
--- a/apps/advanced/common/config/params.php
+++ /dev/null
@@ -1,20 +0,0 @@
- 'admin@example.com',
- 'supportEmail' => 'support@example.com',
-
- 'components.cache' => [
- 'class' => 'yii\caching\FileCache',
- ],
-
- 'components.mail' => [
- 'class' => 'yii\swiftmailer\Mailer',
- 'viewPath' => '@common/mails',
- ],
-];
diff --git a/apps/advanced/common/mails/layouts/html.php b/apps/advanced/common/mails/layouts/html.php
deleted file mode 100644
index 2e6b615..0000000
--- a/apps/advanced/common/mails/layouts/html.php
+++ /dev/null
@@ -1,24 +0,0 @@
-
-beginPage() ?>
-
-
-
-
- = Html::encode($this->title) ?>
- head() ?>
-
-
- beginBody() ?>
- = $content ?>
- endBody() ?>
-
-
-endPage() ?>
\ No newline at end of file
diff --git a/apps/advanced/common/mails/passwordResetToken.php b/apps/advanced/common/mails/passwordResetToken.php
deleted file mode 100644
index b617bd9..0000000
--- a/apps/advanced/common/mails/passwordResetToken.php
+++ /dev/null
@@ -1,16 +0,0 @@
-urlManager->createAbsoluteUrl('site/reset-password', ['token' => $user->password_reset_token]);
-?>
-
-Hello = Html::encode($user->username) ?>,
-
-Follow the link below to reset your password:
-
-= Html::a(Html::encode($resetLink), $resetLink) ?>
diff --git a/apps/advanced/common/models/LoginForm.php b/apps/advanced/common/models/LoginForm.php
deleted file mode 100644
index 38888d9..0000000
--- a/apps/advanced/common/models/LoginForm.php
+++ /dev/null
@@ -1,71 +0,0 @@
-getUser();
- if (!$user || !$user->validatePassword($this->password)) {
- $this->addError('password', 'Incorrect username or password.');
- }
- }
-
- /**
- * Logs in a user using the provided username and password.
- * @return boolean whether the user is logged in successfully
- */
- public function login()
- {
- if ($this->validate()) {
- return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0);
- } else {
- return false;
- }
- }
-
- /**
- * Finds user by [[username]]
- *
- * @return User|null
- */
- private function getUser()
- {
- if ($this->_user === false) {
- $this->_user = User::findByUsername($this->username);
- }
- return $this->_user;
- }
-}
diff --git a/apps/advanced/common/models/User.php b/apps/advanced/common/models/User.php
deleted file mode 100644
index 9642b8c..0000000
--- a/apps/advanced/common/models/User.php
+++ /dev/null
@@ -1,150 +0,0 @@
- [
- 'class' => 'yii\behaviors\AutoTimestamp',
- 'attributes' => [
- ActiveRecord::EVENT_BEFORE_INSERT => ['create_time', 'update_time'],
- ActiveRecord::EVENT_BEFORE_UPDATE => 'update_time',
- ],
- ],
- ];
- }
-
- /**
- * Finds an identity by the given ID.
- *
- * @param string|integer $id the ID to be looked for
- * @return IdentityInterface|null the identity object that matches the given ID.
- */
- public static function findIdentity($id)
- {
- return static::find($id);
- }
-
- /**
- * Finds user by username
- *
- * @param string $username
- * @return null|User
- */
- public static function findByUsername($username)
- {
- return static::find(['username' => $username, 'status' => static::STATUS_ACTIVE]);
- }
-
- /**
- * @return int|string|array current user ID
- */
- public function getId()
- {
- return $this->getPrimaryKey();
- }
-
- /**
- * @return string current user auth key
- */
- public function getAuthKey()
- {
- return $this->auth_key;
- }
-
- /**
- * @param string $authKey
- * @return boolean if auth key is valid for current user
- */
- public function validateAuthKey($authKey)
- {
- return $this->getAuthKey() === $authKey;
- }
-
- /**
- * @param string $password password to validate
- * @return bool if password provided is valid for current user
- */
- public function validatePassword($password)
- {
- return Security::validatePassword($password, $this->password_hash);
- }
-
- public function rules()
- {
- return [
- ['status', 'default', 'value' => self::STATUS_ACTIVE],
- ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]],
-
- ['role', 'default', 'value' => self::ROLE_USER],
- ['role', 'in', 'range' => [self::ROLE_USER]],
-
- ['username', 'filter', 'filter' => 'trim'],
- ['username', 'required'],
- ['username', 'string', 'min' => 2, 'max' => 255],
-
- ['email', 'filter', 'filter' => 'trim'],
- ['email', 'required'],
- ['email', 'email'],
- ['email', 'unique', 'message' => 'This email address has already been taken.', 'on' => 'signup'],
- ['email', 'exist', 'message' => 'There is no user with such email.', 'on' => 'requestPasswordResetToken'],
-
- ['password', 'required'],
- ['password', 'string', 'min' => 6],
- ];
- }
-
- public function scenarios()
- {
- return [
- 'signup' => ['username', 'email', 'password', '!status', '!role'],
- 'resetPassword' => ['password'],
- 'requestPasswordResetToken' => ['email'],
- ];
- }
-
- public function beforeSave($insert)
- {
- if (parent::beforeSave($insert)) {
- if (($this->isNewRecord || $this->getScenario() === 'resetPassword') && !empty($this->password)) {
- $this->password_hash = Security::generatePasswordHash($this->password);
- }
- if ($this->isNewRecord) {
- $this->auth_key = Security::generateRandomKey();
- }
- return true;
- }
- return false;
- }
-}
diff --git a/apps/advanced/composer.json b/apps/advanced/composer.json
deleted file mode 100644
index b44cd7f..0000000
--- a/apps/advanced/composer.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "name": "yiisoft/yii2-app-advanced",
- "description": "Yii 2 Advanced Application Template",
- "keywords": ["yii", "framework", "advanced", "application template"],
- "homepage": "http://www.yiiframework.com/",
- "type": "project",
- "license": "BSD-3-Clause",
- "support": {
- "issues": "https://github.com/yiisoft/yii2/issues?state=open",
- "forum": "http://www.yiiframework.com/forum/",
- "wiki": "http://www.yiiframework.com/wiki/",
- "irc": "irc://irc.freenode.net/yii",
- "source": "https://github.com/yiisoft/yii2"
- },
- "minimum-stability": "dev",
- "require": {
- "php": ">=5.4.0",
- "yiisoft/yii2": "*",
- "yiisoft/yii2-bootstrap": "*",
- "yiisoft/yii2-swiftmailer": "*"
- },
- "require-dev": {
- "yiisoft/yii2-debug": "*",
- "yiisoft/yii2-gii": "*"
- },
- "scripts": {
- "post-create-project-cmd": [
- "yii\\composer\\Installer::setPermission"
- ]
- },
- "config": {
- "process-timeout": 1800
- },
- "extra": {
- "writable": [
- "backend/runtime",
- "backend/web/assets",
-
- "console/runtime",
- "console/migrations",
-
- "frontend/runtime",
- "frontend/web/assets"
- ]
- }
-}
diff --git a/apps/advanced/console/config/.gitignore b/apps/advanced/console/config/.gitignore
deleted file mode 100644
index 20da318..0000000
--- a/apps/advanced/console/config/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-main-local.php
-params-local.php
\ No newline at end of file
diff --git a/apps/advanced/console/config/main.php b/apps/advanced/console/config/main.php
deleted file mode 100644
index 0142e32..0000000
--- a/apps/advanced/console/config/main.php
+++ /dev/null
@@ -1,33 +0,0 @@
- 'app-console',
- 'basePath' => dirname(__DIR__),
- 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
- 'controllerNamespace' => 'console\controllers',
- 'modules' => [
- ],
- 'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
- 'components' => [
- 'db' => $params['components.db'],
- 'cache' => $params['components.cache'],
- 'mail' => $params['components.mail'],
- 'log' => [
- 'targets' => [
- [
- 'class' => 'yii\log\FileTarget',
- 'levels' => ['error', 'warning'],
- ],
- ],
- ],
- ],
- 'params' => $params,
-];
diff --git a/apps/advanced/console/config/params.php b/apps/advanced/console/config/params.php
deleted file mode 100644
index 0e625dc..0000000
--- a/apps/advanced/console/config/params.php
+++ /dev/null
@@ -1,4 +0,0 @@
- 'admin@example.com',
-];
diff --git a/apps/advanced/console/controllers/.gitkeep b/apps/advanced/console/controllers/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/apps/advanced/console/migrations/m130524_201442_init.php b/apps/advanced/console/migrations/m130524_201442_init.php
deleted file mode 100644
index a5935be..0000000
--- a/apps/advanced/console/migrations/m130524_201442_init.php
+++ /dev/null
@@ -1,33 +0,0 @@
-db->driverName === 'mysql') {
- $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
- }
-
- $this->createTable('tbl_user', [
- 'id' => Schema::TYPE_PK,
- 'username' => Schema::TYPE_STRING . ' NOT NULL',
- 'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL',
- 'password_hash' => Schema::TYPE_STRING . ' NOT NULL',
- 'password_reset_token' => Schema::TYPE_STRING . '(32)',
- 'email' => Schema::TYPE_STRING . ' NOT NULL',
- 'role' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10',
-
- 'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10',
- 'create_time' => Schema::TYPE_INTEGER.' NOT NULL',
- 'update_time' => Schema::TYPE_INTEGER.' NOT NULL',
- ], $tableOptions);
- }
-
- public function down()
- {
- $this->dropTable('tbl_user');
- }
-}
diff --git a/apps/advanced/console/models/.gitkeep b/apps/advanced/console/models/.gitkeep
deleted file mode 100644
index 72e8ffc..0000000
--- a/apps/advanced/console/models/.gitkeep
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/apps/advanced/console/runtime/.gitignore b/apps/advanced/console/runtime/.gitignore
deleted file mode 100644
index c96a04f..0000000
--- a/apps/advanced/console/runtime/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/advanced/environments/dev/backend/config/main-local.php b/apps/advanced/environments/dev/backend/config/main-local.php
deleted file mode 100644
index c04d713..0000000
--- a/apps/advanced/environments/dev/backend/config/main-local.php
+++ /dev/null
@@ -1,10 +0,0 @@
- [
- //'debug',
- ],
- 'modules' => [
-// 'debug' => 'yii\debug\Module',
-// 'gii' => 'yii\gii\Module',
- ],
-];
diff --git a/apps/advanced/environments/dev/backend/config/params-local.php b/apps/advanced/environments/dev/backend/config/params-local.php
deleted file mode 100644
index d0b9c34..0000000
--- a/apps/advanced/environments/dev/backend/config/params-local.php
+++ /dev/null
@@ -1,3 +0,0 @@
-run();
diff --git a/apps/advanced/environments/dev/common/config/params-local.php b/apps/advanced/environments/dev/common/config/params-local.php
deleted file mode 100644
index b6a9496..0000000
--- a/apps/advanced/environments/dev/common/config/params-local.php
+++ /dev/null
@@ -1,10 +0,0 @@
- [
- 'class' => 'yii\db\Connection',
- 'dsn' => 'mysql:host=localhost;dbname=yii2advanced',
- 'username' => 'root',
- 'password' => '',
- 'charset' => 'utf8',
- ],
-];
diff --git a/apps/advanced/environments/dev/console/config/main-local.php b/apps/advanced/environments/dev/console/config/main-local.php
deleted file mode 100644
index d0b9c34..0000000
--- a/apps/advanced/environments/dev/console/config/main-local.php
+++ /dev/null
@@ -1,3 +0,0 @@
- [
- //'debug',
- ],
- 'modules' => [
-// 'debug' => 'yii\debug\Module',
-// 'gii' => 'yii\gii\Module',
- ],
-];
diff --git a/apps/advanced/environments/dev/frontend/config/params-local.php b/apps/advanced/environments/dev/frontend/config/params-local.php
deleted file mode 100644
index d0b9c34..0000000
--- a/apps/advanced/environments/dev/frontend/config/params-local.php
+++ /dev/null
@@ -1,3 +0,0 @@
-run();
diff --git a/apps/advanced/environments/dev/yii b/apps/advanced/environments/dev/yii
deleted file mode 100644
index 5d1cd90..0000000
--- a/apps/advanced/environments/dev/yii
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env php
-run();
-exit($exitCode);
diff --git a/apps/advanced/environments/index.php b/apps/advanced/environments/index.php
deleted file mode 100644
index a2097bf..0000000
--- a/apps/advanced/environments/index.php
+++ /dev/null
@@ -1,38 +0,0 @@
- [
- * 'path' => 'directory storing the local files',
- * 'writable' => [
- * // list of directories that should be set writable
- * ],
- * ],
- * ];
- * ```
- */
-return [
- 'Development' => [
- 'path' => 'dev',
- 'writable' => [
- // handled by composer.json already
- ],
- 'executable' => [
- 'yii',
- ],
- ],
- 'Production' => [
- 'path' => 'prod',
- 'writable' => [
- // handled by composer.json already
- ],
- 'executable' => [
- 'yii',
- ],
- ],
-];
diff --git a/apps/advanced/environments/prod/backend/config/main-local.php b/apps/advanced/environments/prod/backend/config/main-local.php
deleted file mode 100644
index d0b9c34..0000000
--- a/apps/advanced/environments/prod/backend/config/main-local.php
+++ /dev/null
@@ -1,3 +0,0 @@
-run();
diff --git a/apps/advanced/environments/prod/common/config/params-local.php b/apps/advanced/environments/prod/common/config/params-local.php
deleted file mode 100644
index b6a9496..0000000
--- a/apps/advanced/environments/prod/common/config/params-local.php
+++ /dev/null
@@ -1,10 +0,0 @@
- [
- 'class' => 'yii\db\Connection',
- 'dsn' => 'mysql:host=localhost;dbname=yii2advanced',
- 'username' => 'root',
- 'password' => '',
- 'charset' => 'utf8',
- ],
-];
diff --git a/apps/advanced/environments/prod/console/config/main-local.php b/apps/advanced/environments/prod/console/config/main-local.php
deleted file mode 100644
index d0b9c34..0000000
--- a/apps/advanced/environments/prod/console/config/main-local.php
+++ /dev/null
@@ -1,3 +0,0 @@
-run();
diff --git a/apps/advanced/environments/prod/yii b/apps/advanced/environments/prod/yii
deleted file mode 100644
index b17d9a7..0000000
--- a/apps/advanced/environments/prod/yii
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env php
-run();
-exit($exitCode);
diff --git a/apps/advanced/frontend/assets/AppAsset.php b/apps/advanced/frontend/assets/AppAsset.php
deleted file mode 100644
index 03c5382..0000000
--- a/apps/advanced/frontend/assets/AppAsset.php
+++ /dev/null
@@ -1,29 +0,0 @@
-
- * @since 2.0
- */
-class AppAsset extends AssetBundle
-{
- public $basePath = '@webroot';
- public $baseUrl = '@web';
- public $css = [
- 'css/site.css',
- ];
- public $js = [
- ];
- public $depends = [
- 'yii\web\YiiAsset',
- 'yii\bootstrap\BootstrapAsset',
- ];
-}
diff --git a/apps/advanced/frontend/config/.gitignore b/apps/advanced/frontend/config/.gitignore
deleted file mode 100644
index 20da318..0000000
--- a/apps/advanced/frontend/config/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-main-local.php
-params-local.php
\ No newline at end of file
diff --git a/apps/advanced/frontend/config/main.php b/apps/advanced/frontend/config/main.php
deleted file mode 100644
index 60fb4c2..0000000
--- a/apps/advanced/frontend/config/main.php
+++ /dev/null
@@ -1,39 +0,0 @@
- 'app-frontend',
- 'basePath' => dirname(__DIR__),
- 'vendorPath' => $rootDir . '/vendor',
- 'controllerNamespace' => 'frontend\controllers',
- 'extensions' => require($rootDir . '/vendor/yiisoft/extensions.php'),
- 'components' => [
- 'db' => $params['components.db'],
- 'cache' => $params['components.cache'],
- 'mail' => $params['components.mail'],
- 'user' => [
- 'identityClass' => 'common\models\User',
- 'enableAutoLogin' => true,
- ],
- 'log' => [
- 'traceLevel' => YII_DEBUG ? 3 : 0,
- 'targets' => [
- [
- 'class' => 'yii\log\FileTarget',
- 'levels' => ['error', 'warning'],
- ],
- ],
- ],
- 'errorHandler' => [
- 'errorAction' => 'site/error',
- ],
- ],
- 'params' => $params,
-];
diff --git a/apps/advanced/frontend/config/params.php b/apps/advanced/frontend/config/params.php
deleted file mode 100644
index 0e625dc..0000000
--- a/apps/advanced/frontend/config/params.php
+++ /dev/null
@@ -1,4 +0,0 @@
- 'admin@example.com',
-];
diff --git a/apps/advanced/frontend/controllers/SiteController.php b/apps/advanced/frontend/controllers/SiteController.php
deleted file mode 100644
index db6dbe6..0000000
--- a/apps/advanced/frontend/controllers/SiteController.php
+++ /dev/null
@@ -1,171 +0,0 @@
- [
- 'class' => \yii\web\AccessControl::className(),
- 'only' => ['logout', 'signup'],
- 'rules' => [
- [
- 'actions' => ['signup'],
- 'allow' => true,
- 'roles' => ['?'],
- ],
- [
- 'actions' => ['logout'],
- 'allow' => true,
- 'roles' => ['@'],
- ],
- ],
- ],
- ];
- }
-
- public function actions()
- {
- return [
- 'error' => [
- 'class' => 'yii\web\ErrorAction',
- ],
- 'captcha' => [
- 'class' => 'yii\captcha\CaptchaAction',
- 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
- ],
- ];
- }
-
- public function actionIndex()
- {
- return $this->render('index');
- }
-
- public function actionLogin()
- {
- if (!\Yii::$app->user->isGuest) {
- $this->goHome();
- }
-
- $model = new LoginForm();
- if ($model->load($_POST) && $model->login()) {
- return $this->goBack();
- } else {
- return $this->render('login', [
- 'model' => $model,
- ]);
- }
- }
-
- public function actionLogout()
- {
- Yii::$app->user->logout();
- return $this->goHome();
- }
-
- public function actionContact()
- {
- $model = new ContactForm;
- if ($model->load($_POST) && $model->contact(Yii::$app->params['adminEmail'])) {
- Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
- return $this->refresh();
- } else {
- return $this->render('contact', [
- 'model' => $model,
- ]);
- }
- }
-
- public function actionAbout()
- {
- return $this->render('about');
- }
-
- public function actionSignup()
- {
- $model = new User();
- $model->setScenario('signup');
- if ($model->load($_POST) && $model->save()) {
- if (Yii::$app->getUser()->login($model)) {
- return $this->goHome();
- }
- }
-
- return $this->render('signup', [
- 'model' => $model,
- ]);
- }
-
- public function actionRequestPasswordReset()
- {
- $model = new User();
- $model->scenario = 'requestPasswordResetToken';
- if ($model->load($_POST) && $model->validate()) {
- if ($this->sendPasswordResetEmail($model->email)) {
- Yii::$app->getSession()->setFlash('success', 'Check your email for further instructions.');
- return $this->goHome();
- } else {
- Yii::$app->getSession()->setFlash('error', 'There was an error sending email.');
- }
- }
- return $this->render('requestPasswordResetToken', [
- 'model' => $model,
- ]);
- }
-
- public function actionResetPassword($token)
- {
- $model = User::find([
- 'password_reset_token' => $token,
- 'status' => User::STATUS_ACTIVE,
- ]);
-
- if (!$model) {
- throw new BadRequestHttpException('Wrong password reset token.');
- }
-
- $model->scenario = 'resetPassword';
- if ($model->load($_POST) && $model->save()) {
- Yii::$app->getSession()->setFlash('success', 'New password was saved.');
- return $this->goHome();
- }
-
- return $this->render('resetPassword', [
- 'model' => $model,
- ]);
- }
-
- private function sendPasswordResetEmail($email)
- {
- $user = User::find([
- 'status' => User::STATUS_ACTIVE,
- 'email' => $email,
- ]);
-
- if (!$user) {
- return false;
- }
-
- $user->password_reset_token = Security::generateRandomKey();
- if ($user->save(false)) {
- return \Yii::$app->mail->compose('passwordResetToken', ['user' => $user])
- ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'])
- ->setTo($email)
- ->setSubject('Password reset for ' . \Yii::$app->name)
- ->send();
- }
-
- return false;
- }
-}
diff --git a/apps/advanced/frontend/models/ContactForm.php b/apps/advanced/frontend/models/ContactForm.php
deleted file mode 100644
index 0a664ad..0000000
--- a/apps/advanced/frontend/models/ContactForm.php
+++ /dev/null
@@ -1,63 +0,0 @@
- 'Verification Code',
- ];
- }
-
- /**
- * Sends an email to the specified email address using the information collected by this model.
- * @param string $email the target email address
- * @return boolean whether the model passes validation
- */
- public function contact($email)
- {
- if ($this->validate()) {
- Yii::$app->mail->compose()
- ->setTo($email)
- ->setFrom([$this->email => $this->name])
- ->setSubject($this->subject)
- ->setTextBody($this->body)
- ->send();
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/apps/advanced/frontend/runtime/.gitignore b/apps/advanced/frontend/runtime/.gitignore
deleted file mode 100644
index c96a04f..0000000
--- a/apps/advanced/frontend/runtime/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/advanced/frontend/views/layouts/main.php b/apps/advanced/frontend/views/layouts/main.php
deleted file mode 100644
index 2bfa9b0..0000000
--- a/apps/advanced/frontend/views/layouts/main.php
+++ /dev/null
@@ -1,70 +0,0 @@
-
-beginPage() ?>
-
-
-
-
-
- = Html::encode($this->title) ?>
- head() ?>
-
-
- beginBody() ?>
- 'My Company',
- 'brandUrl' => Yii::$app->homeUrl,
- 'options' => [
- 'class' => 'navbar-inverse navbar-fixed-top',
- ],
- ]);
- $menuItems = [
- ['label' => 'Home', 'url' => ['/site/index']],
- ['label' => 'About', 'url' => ['/site/about']],
- ['label' => 'Contact', 'url' => ['/site/contact']],
- ];
- if (Yii::$app->user->isGuest) {
- $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
- $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
- } else {
- $menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => ['/site/logout']];
- }
- echo Nav::widget([
- 'options' => ['class' => 'navbar-nav navbar-right'],
- 'items' => $menuItems,
- ]);
- NavBar::end();
- ?>
-
-
- = Breadcrumbs::widget([
- 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
- ]) ?>
- = Alert::widget() ?>
- = $content ?>
-
-
-
-
- endBody() ?>
-
-
-endPage() ?>
diff --git a/apps/advanced/frontend/views/site/about.php b/apps/advanced/frontend/views/site/about.php
deleted file mode 100644
index ac4ab24..0000000
--- a/apps/advanced/frontend/views/site/about.php
+++ /dev/null
@@ -1,16 +0,0 @@
-title = 'About';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-
-
= Html::encode($this->title) ?>
-
-
This is the About page. You may modify the following file to customize its content:
-
-
= __FILE__ ?>
-
diff --git a/apps/advanced/frontend/views/site/contact.php b/apps/advanced/frontend/views/site/contact.php
deleted file mode 100644
index 9aa98e6..0000000
--- a/apps/advanced/frontend/views/site/contact.php
+++ /dev/null
@@ -1,38 +0,0 @@
-title = 'Contact';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-
diff --git a/apps/advanced/frontend/views/site/error.php b/apps/advanced/frontend/views/site/error.php
deleted file mode 100644
index 1b7ce04..0000000
--- a/apps/advanced/frontend/views/site/error.php
+++ /dev/null
@@ -1,29 +0,0 @@
-title = $name;
-?>
-
-
-
= Html::encode($this->title) ?>
-
-
- = nl2br(Html::encode($message)) ?>
-
-
-
- The above error occurred while the Web server was processing your request.
-
-
- Please contact us if you think this is a server error. Thank you.
-
-
-
diff --git a/apps/advanced/frontend/views/site/index.php b/apps/advanced/frontend/views/site/index.php
deleted file mode 100644
index bcb2278..0000000
--- a/apps/advanced/frontend/views/site/index.php
+++ /dev/null
@@ -1,53 +0,0 @@
-title = 'My Yii Application';
-?>
-
-
-
-
Congratulations!
-
-
You have successfully created your Yii-powered application.
-
-
Get started with Yii
-
-
-
-
-
-
-
Heading
-
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
- dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
- ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
- fugiat nulla pariatur.
-
-
Yii Documentation »
-
-
-
Heading
-
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
- dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
- ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
- fugiat nulla pariatur.
-
-
Yii Forum »
-
-
-
Heading
-
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
- dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
- ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
- fugiat nulla pariatur.
-
-
Yii Extensions »
-
-
-
-
-
diff --git a/apps/advanced/frontend/views/site/login.php b/apps/advanced/frontend/views/site/login.php
deleted file mode 100644
index 75dd4ca..0000000
--- a/apps/advanced/frontend/views/site/login.php
+++ /dev/null
@@ -1,33 +0,0 @@
-title = 'Login';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-
-
= Html::encode($this->title) ?>
-
-
Please fill out the following fields to login:
-
-
-
- 'login-form']); ?>
- = $form->field($model, 'username') ?>
- = $form->field($model, 'password')->passwordInput() ?>
- = $form->field($model, 'rememberMe')->checkbox() ?>
-
- If you forgot your password you can = Html::a('reset it', ['site/request-password-reset']) ?>.
-
-
- = Html::submitButton('Login', ['class' => 'btn btn-primary']) ?>
-
-
-
-
-
diff --git a/apps/advanced/frontend/views/site/requestPasswordResetToken.php b/apps/advanced/frontend/views/site/requestPasswordResetToken.php
deleted file mode 100644
index bb13a5f..0000000
--- a/apps/advanced/frontend/views/site/requestPasswordResetToken.php
+++ /dev/null
@@ -1,28 +0,0 @@
-title = 'Request password reset';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-
-
= Html::encode($this->title) ?>
-
-
Please fill out your email. A link to reset password will be sent there.
-
-
-
- 'request-password-reset-form']); ?>
- = $form->field($model, 'email') ?>
-
- = Html::submitButton('Send', ['class' => 'btn btn-primary']) ?>
-
-
-
-
-
diff --git a/apps/advanced/frontend/views/site/resetPassword.php b/apps/advanced/frontend/views/site/resetPassword.php
deleted file mode 100644
index ec9f949..0000000
--- a/apps/advanced/frontend/views/site/resetPassword.php
+++ /dev/null
@@ -1,28 +0,0 @@
-title = 'Reset password';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-
-
= Html::encode($this->title) ?>
-
-
Please choose your new password:
-
-
-
- 'reset-password-form']); ?>
- = $form->field($model, 'password')->passwordInput() ?>
-
- = Html::submitButton('Save', ['class' => 'btn btn-primary']) ?>
-
-
-
-
-
diff --git a/apps/advanced/frontend/views/site/signup.php b/apps/advanced/frontend/views/site/signup.php
deleted file mode 100644
index 3bb57fc..0000000
--- a/apps/advanced/frontend/views/site/signup.php
+++ /dev/null
@@ -1,30 +0,0 @@
-title = 'Signup';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-
-
= Html::encode($this->title) ?>
-
-
Please fill out the following fields to signup:
-
-
-
- 'form-signup']); ?>
- = $form->field($model, 'username') ?>
- = $form->field($model, 'email') ?>
- = $form->field($model, 'password')->passwordInput() ?>
-
- = Html::submitButton('Signup', ['class' => 'btn btn-primary']) ?>
-
-
-
-
-
diff --git a/apps/advanced/frontend/web/.gitignore b/apps/advanced/frontend/web/.gitignore
deleted file mode 100644
index 148f2b0..0000000
--- a/apps/advanced/frontend/web/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/index.php
\ No newline at end of file
diff --git a/apps/advanced/frontend/web/assets/.gitignore b/apps/advanced/frontend/web/assets/.gitignore
deleted file mode 100644
index c96a04f..0000000
--- a/apps/advanced/frontend/web/assets/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/advanced/frontend/web/css/site.css b/apps/advanced/frontend/web/css/site.css
deleted file mode 100644
index a8508c4..0000000
--- a/apps/advanced/frontend/web/css/site.css
+++ /dev/null
@@ -1,79 +0,0 @@
-body {
- padding-top: 70px;
-}
-
-.footer {
- border-top: 1px solid #ddd;
- margin-top: 30px;
- padding-top: 15px;
- padding-bottom: 30px;
-}
-
-.jumbotron {
- text-align: center;
- background-color: transparent;
-}
-
-.jumbotron .btn {
- font-size: 21px;
- padding: 14px 24px;
-}
-
-.not-set {
- color: #c55;
- font-style: italic;
-}
-
-/* add sorting icons to gridview sort links */
-a.asc:after, a.desc:after {
- position: relative;
- top: 1px;
- display: inline-block;
- font-family: 'Glyphicons Halflings';
- font-style: normal;
- font-weight: normal;
- line-height: 1;
- padding-left: 5px;
-}
-
-a.asc:after {
- content: /*"\e113"*/ "\e151";
-}
-
-a.desc:after {
- content: /*"\e114"*/ "\e152";
-}
-
-.sort-numerical a.asc:after {
- content: "\e153";
-}
-
-.sort-numerical a.desc:after {
- content: "\e154";
-}
-
-.sort-ordinal a.asc:after {
- content: "\e155";
-}
-
-.sort-ordinal a.desc:after {
- content: "\e156";
-}
-
-.grid-view th {
- white-space: nowrap;
-}
-
-.hint-block {
- display: block;
- margin-top: 5px;
- color: #999;
-}
-
-.error-summary {
- color: #a94442;
- background: #fdf7f7;
- border-left: 3px solid #eed3d7;
- padding: 10px 20px;
- margin: 0 0 15px 0;
-}
diff --git a/apps/advanced/frontend/web/favicon.ico b/apps/advanced/frontend/web/favicon.ico
deleted file mode 100644
index 49e61e3..0000000
Binary files a/apps/advanced/frontend/web/favicon.ico and /dev/null differ
diff --git a/apps/advanced/frontend/web/robots.txt b/apps/advanced/frontend/web/robots.txt
deleted file mode 100644
index 6f27bb6..0000000
--- a/apps/advanced/frontend/web/robots.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-User-agent: *
-Disallow:
\ No newline at end of file
diff --git a/apps/advanced/frontend/widgets/Alert.php b/apps/advanced/frontend/widgets/Alert.php
deleted file mode 100644
index 390f359..0000000
--- a/apps/advanced/frontend/widgets/Alert.php
+++ /dev/null
@@ -1,66 +0,0 @@
-getSession()->setFlash('error', 'This is the message');
- * - \Yii::$app->getSession()->setFlash('success', 'This is the message');
- * - \Yii::$app->getSession()->setFlash('info', 'This is the message');
- *
- * @author Kartik Visweswaran
- * @author Alexander Makarov
- */
-class Alert extends \yii\bootstrap\Widget
-{
- /**
- * @var array the alert types configuration for the flash messages.
- * This array is setup as $key => $value, where:
- * - $key is the name of the session flash variable
- * - $value is the bootstrap alert type (i.e. danger, success, info, warning)
- */
- public $alertTypes = [
- 'error' => 'danger',
- 'danger' => 'danger',
- 'success' => 'success',
- 'info' => 'info',
- 'warning' => 'warning'
- ];
-
- /**
- * @var array the options for rendering the close button tag.
- */
- public $closeButton = [];
-
- public function init()
- {
- parent::init();
-
- $session = \Yii::$app->getSession();
- $flashes = $session->getAllFlashes();
- $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : '';
-
- foreach ($flashes as $type => $message) {
- /* initialize css class for each alert box */
- $this->options['class'] = 'alert-' . $this->alertTypes[$type] . $appendCss;
-
- /* assign unique id to each alert box */
- $this->options['id'] = $this->getId() . '-' . $type;
-
- echo \yii\bootstrap\Alert::widget([
- 'body' => $message,
- 'closeButton' => $this->closeButton,
- 'options' => $this->options
- ]);
-
- $session->removeFlash($type);
- }
- }
-}
diff --git a/apps/advanced/init b/apps/advanced/init
deleted file mode 100755
index 4015748..0000000
--- a/apps/advanced/init
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/usr/bin/env php
- $name) {
- echo " [$i] $name\n";
- }
- echo "\n Your choice [0-" . (count($envs) - 1) . ', or "q" to quit] ';
- $answer = trim(fgets(STDIN));
-
- if (!ctype_digit($answer) || !in_array($answer, range(0, count($envs) - 1))) {
- echo "\n Quit initialization.\n";
- exit(0);
- }
-
- if (isset($envNames[$answer])) {
- $envName = $envNames[$answer];
- }
-}
-else {
- $envName = $params['env'];
-}
-
-if (!in_array($envName, $envNames)) {
- $envsList = implode(', ', $envNames);
- echo "\n $envName is not a valid environment. Try one of the following: $envsList. \n";
- exit(2);
-}
-
-$env = $envs[$envName];
-
-if (empty($params['env'])) {
- echo "\n Initialize the application under '{$envNames[$answer]}' environment? [yes|no] ";
- $answer = trim(fgets(STDIN));
- if (strncasecmp($answer, 'y', 1)) {
- echo "\n Quit initialization.\n";
- exit(0);
- }
-}
-
-echo "\n Start initialization ...\n\n";
-$files = getFileList("$root/environments/{$env['path']}");
-$all = false;
-foreach ($files as $file) {
- if (!copyFile($root, "environments/{$env['path']}/$file", $file, $all)) {
- break;
- }
-}
-
-if (isset($env['writable'])) {
- foreach ($env['writable'] as $writable) {
- echo " chmod 0777 $writable\n";
- @chmod("$root/$writable", 0777);
- }
-}
-
-if (isset($env['executable'])) {
- foreach ($env['executable'] as $executable) {
- echo " chmod 0755 $executable\n";
- @chmod("$root/$executable", 0755);
- }
-}
-
-echo "\n ... initialization completed.\n\n";
-
-function getFileList($root, $basePath = '')
-{
- $files = [];
- $handle = opendir($root);
- while (($path = readdir($handle)) !== false) {
- if ($path === '.svn' || $path === '.' || $path === '..') {
- continue;
- }
- $fullPath = "$root/$path";
- $relativePath = $basePath === '' ? $path : "$basePath/$path";
- if (is_dir($fullPath)) {
- $files = array_merge($files, getFileList($fullPath, $relativePath));
- } else {
- $files[] = $relativePath;
- }
- }
- closedir($handle);
- return $files;
-}
-
-function copyFile($root, $source, $target, &$all)
-{
- if (!is_file($root . '/' . $source)) {
- echo " skip $target ($source not exist)\n";
- return true;
- }
- if (is_file($root . '/' . $target)) {
- if (file_get_contents($root . '/' . $source) === file_get_contents($root . '/' . $target)) {
- echo " unchanged $target\n";
- return true;
- }
- if ($all) {
- echo " overwrite $target\n";
- } else {
- echo " exist $target\n";
- echo " ...overwrite? [Yes|No|All|Quit] ";
- $answer = trim(fgets(STDIN));
- if (!strncasecmp($answer, 'q', 1)) {
- return false;
- } else {
- if (!strncasecmp($answer, 'y', 1)) {
- echo " overwrite $target\n";
- } else {
- if (!strncasecmp($answer, 'a', 1)) {
- echo " overwrite $target\n";
- $all = true;
- } else {
- echo " skip $target\n";
- return true;
- }
- }
- }
- }
- file_put_contents($root . '/' . $target, file_get_contents($root . '/' . $source));
- return true;
- }
- echo " generate $target\n";
- @mkdir(dirname($root . '/' . $target), 0777, true);
- file_put_contents($root . '/' . $target, file_get_contents($root . '/' . $source));
- return true;
-}
-
-function getParams()
-{
- $rawParams = [];
- if (isset($_SERVER['argv'])) {
- $rawParams = $_SERVER['argv'];
- array_shift($rawParams);
- }
-
- $params = [];
- foreach ($rawParams as $param) {
- if (preg_match('/^--(\w+)(=(.*))?$/', $param, $matches)) {
- $name = $matches[1];
- $params[$name] = isset($matches[3]) ? $matches[3] : true;
- } else {
- $params[] = $param;
- }
- }
- return $params;
-}
diff --git a/apps/advanced/init.bat b/apps/advanced/init.bat
deleted file mode 100644
index 4fc52f7..0000000
--- a/apps/advanced/init.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@echo off
-
-rem -------------------------------------------------------------
-rem Yii command line init script for Windows.
-rem
-rem @author Qiang Xue
-rem @link http://www.yiiframework.com/
-rem @copyright Copyright © 2012 Yii Software LLC
-rem @license http://www.yiiframework.com/license/
-rem -------------------------------------------------------------
-
-@setlocal
-
-set YII_PATH=%~dp0
-
-if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
-
-"%PHP_COMMAND%" "%YII_PATH%init" %*
-
-@endlocal
diff --git a/apps/advanced/requirements.php b/apps/advanced/requirements.php
deleted file mode 100644
index 5c6495c..0000000
--- a/apps/advanced/requirements.php
+++ /dev/null
@@ -1,110 +0,0 @@
-Error';
- echo 'The path to yii framework seems to be incorrect.
';
- echo 'You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) .'.
';
- echo 'Please refer to the README on how to install Yii.
';
-}
-
-require_once($frameworkPath . '/requirements/YiiRequirementChecker.php');
-$requirementsChecker = new YiiRequirementChecker();
-
-/**
- * Adjust requirements according to your application specifics.
- */
-$requirements = array(
- // Database :
- array(
- 'name' => 'PDO extension',
- 'mandatory' => true,
- 'condition' => extension_loaded('pdo'),
- 'by' => 'All DB-related classes',
- ),
- array(
- 'name' => 'PDO SQLite extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('pdo_sqlite'),
- 'by' => 'All DB-related classes',
- 'memo' => 'Required for SQLite database.',
- ),
- array(
- 'name' => 'PDO MySQL extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('pdo_mysql'),
- 'by' => 'All DB-related classes',
- 'memo' => 'Required for MySQL database.',
- ),
- array(
- 'name' => 'PDO PostgreSQL extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('pdo_pgsql'),
- 'by' => 'All DB-related classes',
- 'memo' => 'Required for PostgreSQL database.',
- ),
- // Cache :
- array(
- 'name' => 'Memcache extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('memcache') || extension_loaded('memcached'),
- 'by' => 'CMemCache',
- 'memo' => extension_loaded('memcached') ? 'To use memcached set CMemCache::useMemcached to true
.' : ''
- ),
- array(
- 'name' => 'APC extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('apc'),
- 'by' => 'CApcCache',
- ),
- // Additional PHP extensions :
- array(
- 'name' => 'Mcrypt extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('mcrypt'),
- 'by' => 'CSecurityManager',
- 'memo' => 'Required by encrypt and decrypt methods.'
- ),
- // PHP ini :
- 'phpSafeMode' => array(
- 'name' => 'PHP safe mode',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"),
- 'by' => 'File uploading and console command execution',
- 'memo' => '"safe_mode" should be disabled at php.ini',
- ),
- 'phpExposePhp' => array(
- 'name' => 'Expose PHP',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
- 'by' => 'Security reasons',
- 'memo' => '"expose_php" should be disabled at php.ini',
- ),
- 'phpAllowUrlInclude' => array(
- 'name' => 'PHP allow url include',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
- 'by' => 'Security reasons',
- 'memo' => '"allow_url_include" should be disabled at php.ini',
- ),
- 'phpSmtp' => array(
- 'name' => 'PHP mail SMTP',
- 'mandatory' => false,
- 'condition' => strlen(ini_get('SMTP'))>0,
- 'by' => 'Email sending',
- 'memo' => 'PHP mail SMTP server required',
- ),
-);
-$requirementsChecker->checkYii()->check($requirements)->render();
diff --git a/apps/advanced/vendor/.gitignore b/apps/advanced/vendor/.gitignore
deleted file mode 100644
index c96a04f..0000000
--- a/apps/advanced/vendor/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/advanced/yii.bat b/apps/advanced/yii.bat
deleted file mode 100644
index 5e21e2e..0000000
--- a/apps/advanced/yii.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@echo off
-
-rem -------------------------------------------------------------
-rem Yii command line bootstrap script for Windows.
-rem
-rem @author Qiang Xue
-rem @link http://www.yiiframework.com/
-rem @copyright Copyright © 2012 Yii Software LLC
-rem @license http://www.yiiframework.com/license/
-rem -------------------------------------------------------------
-
-@setlocal
-
-set YII_PATH=%~dp0
-
-if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
-
-"%PHP_COMMAND%" "%YII_PATH%yii" %*
-
-@endlocal
diff --git a/apps/basic/LICENSE.md b/apps/basic/LICENSE.md
deleted file mode 100644
index e98f03d..0000000
--- a/apps/basic/LICENSE.md
+++ /dev/null
@@ -1,32 +0,0 @@
-The Yii framework is free software. It is released under the terms of
-the following BSD License.
-
-Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of Yii Software LLC nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/apps/basic/README.md b/apps/basic/README.md
deleted file mode 100644
index b233770..0000000
--- a/apps/basic/README.md
+++ /dev/null
@@ -1,64 +0,0 @@
-Yii 2 Basic Application Template
-================================
-
-Yii 2 Basic Application Template is a skeleton Yii 2 application best for
-rapidly developing small Websites containing mainly informational pages.
-
-The template contains the basic features including user login/logout and a contact page.
-It includes all commonly used configurations that would allow you to focus on adding new
-features to your application.
-
-
-DIRECTORY STRUCTURE
--------------------
-
- commands/ contains console commands (controllers)
- config/ contains application configurations
- controllers/ contains Web controller classes
- models/ contains model classes
- runtime/ contains files generated during runtime
- vendor/ contains dependent 3rd-party packages
- views/ contains view files for the Web application
- web/ contains the entry script and Web resources
-
-
-
-REQUIREMENTS
-------------
-
-The minimum requirement by this application template that your Web server supports PHP 5.4.0.
-
-
-INSTALLATION
-------------
-
-### Install from an Archive File
-
-Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to
-a directory named `basic` that is directly under the Web root.
-
-You can then access the application through the following URL:
-
-~~~
-http://localhost/basic/web/
-~~~
-
-
-### Install via Composer
-
-If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions
-at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix).
-
-You can then install this application template using the following command:
-
-~~~
-php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
-~~~
-
-Now you should be able to access the application through the following URL, assuming `basic` is the directory
-directly under the Web root.
-
-~~~
-http://localhost/basic/web/
-~~~
-
diff --git a/apps/basic/assets/AppAsset.php b/apps/basic/assets/AppAsset.php
deleted file mode 100644
index c964d36..0000000
--- a/apps/basic/assets/AppAsset.php
+++ /dev/null
@@ -1,29 +0,0 @@
-
- * @since 2.0
- */
-class AppAsset extends AssetBundle
-{
- public $basePath = '@webroot';
- public $baseUrl = '@web';
- public $css = [
- 'css/site.css',
- ];
- public $js = [
- ];
- public $depends = [
- 'yii\web\YiiAsset',
- 'yii\bootstrap\BootstrapAsset',
- ];
-}
diff --git a/apps/basic/codeception.yml b/apps/basic/codeception.yml
deleted file mode 100644
index 864fba0..0000000
--- a/apps/basic/codeception.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-paths:
- tests: tests
- log: tests/_log
- data: tests/_data
- helpers: tests/_helpers
-settings:
- bootstrap: _bootstrap.php
- suite_class: \PHPUnit_Framework_TestSuite
- memory_limit: 1024M
- log: true
- colors: true
-modules:
- config:
- Db:
- dsn: ''
- user: ''
- password: ''
- dump: tests/_data/dump.sql
diff --git a/apps/basic/commands/HelloController.php b/apps/basic/commands/HelloController.php
deleted file mode 100644
index ce567dd..0000000
--- a/apps/basic/commands/HelloController.php
+++ /dev/null
@@ -1,30 +0,0 @@
-
- * @since 2.0
- */
-class HelloController extends Controller
-{
- /**
- * This command echoes what you have entered as the message.
- * @param string $message the message to be echoed.
- */
- public function actionIndex($message = 'hello world')
- {
- echo $message . "\n";
- }
-}
diff --git a/apps/basic/composer.json b/apps/basic/composer.json
deleted file mode 100644
index e45c994..0000000
--- a/apps/basic/composer.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "name": "yiisoft/yii2-app-basic",
- "description": "Yii 2 Basic Application Template",
- "keywords": ["yii", "framework", "basic", "application template"],
- "homepage": "http://www.yiiframework.com/",
- "type": "project",
- "license": "BSD-3-Clause",
- "support": {
- "issues": "https://github.com/yiisoft/yii2/issues?state=open",
- "forum": "http://www.yiiframework.com/forum/",
- "wiki": "http://www.yiiframework.com/wiki/",
- "irc": "irc://irc.freenode.net/yii",
- "source": "https://github.com/yiisoft/yii2"
- },
- "minimum-stability": "dev",
- "require": {
- "php": ">=5.4.0",
- "yiisoft/yii2": "*",
- "yiisoft/yii2-bootstrap": "*",
- "yiisoft/yii2-swiftmailer": "*"
- },
- "require-dev": {
- "yiisoft/yii2-codeception": "*",
- "yiisoft/yii2-debug": "*",
- "yiisoft/yii2-gii": "*",
- "codeception/codeception": "*",
- "codeception/specify": "*"
- },
- "scripts": {
- "post-create-project-cmd": [
- "yii\\composer\\Installer::setPermission"
- ]
- },
- "config": {
- "process-timeout": 1800
- },
- "extra": {
- "writable": [
- "runtime",
- "web/assets"
- ],
- "executable": [
- "yii"
- ]
- }
-}
diff --git a/apps/basic/config/console.php b/apps/basic/config/console.php
deleted file mode 100644
index 6b245c4..0000000
--- a/apps/basic/config/console.php
+++ /dev/null
@@ -1,34 +0,0 @@
- 'basic-console',
- 'basePath' => dirname(__DIR__),
- 'preload' => ['log'],
- 'controllerPath' => dirname(__DIR__) . '/commands',
- 'controllerNamespace' => 'app\commands',
- 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
- 'components' => [
- 'cache' => [
- 'class' => 'yii\caching\FileCache',
- ],
- 'log' => [
- 'targets' => [
- [
- 'class' => 'yii\log\FileTarget',
- 'levels' => ['error', 'warning'],
- ],
- ],
- ],
- 'db' => $db,
- 'fixture' => [
- 'class' => 'yii\test\DbFixtureManager',
- 'basePath' => '@tests/unit/fixtures',
- ],
- ],
- 'params' => $params,
-];
diff --git a/apps/basic/config/db.php b/apps/basic/config/db.php
deleted file mode 100644
index b14e77e..0000000
--- a/apps/basic/config/db.php
+++ /dev/null
@@ -1,9 +0,0 @@
- 'yii\db\Connection',
- 'dsn' => 'mysql:host=localhost;dbname=yii2basic',
- 'username' => 'root',
- 'password' => '',
- 'charset' => 'utf8',
-];
diff --git a/apps/basic/config/params.php b/apps/basic/config/params.php
deleted file mode 100644
index 93cb368..0000000
--- a/apps/basic/config/params.php
+++ /dev/null
@@ -1,5 +0,0 @@
- 'admin@example.com',
-];
diff --git a/apps/basic/config/web.php b/apps/basic/config/web.php
deleted file mode 100644
index 56ec9f8..0000000
--- a/apps/basic/config/web.php
+++ /dev/null
@@ -1,45 +0,0 @@
- 'basic',
- 'basePath' => dirname(__DIR__),
- 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
- 'components' => [
- 'cache' => [
- 'class' => 'yii\caching\FileCache',
- ],
- 'user' => [
- 'identityClass' => 'app\models\User',
- 'enableAutoLogin' => true,
- ],
- 'errorHandler' => [
- 'errorAction' => 'site/error',
- ],
- 'mail' => [
- 'class' => 'yii\swiftmailer\Mailer',
- ],
- 'log' => [
- 'traceLevel' => YII_DEBUG ? 3 : 0,
- 'targets' => [
- [
- 'class' => 'yii\log\FileTarget',
- 'levels' => ['error', 'warning'],
- ],
- ],
- ],
- 'db' => $db,
- ],
- 'params' => $params,
-];
-
-if (YII_ENV_DEV) {
- // configuration adjustments for 'dev' environment
- $config['preload'][] = 'debug';
- $config['modules']['debug'] = 'yii\debug\Module';
- $config['modules']['gii'] = 'yii\gii\Module';
-}
-
-return $config;
diff --git a/apps/basic/controllers/SiteController.php b/apps/basic/controllers/SiteController.php
deleted file mode 100644
index e3ca29b..0000000
--- a/apps/basic/controllers/SiteController.php
+++ /dev/null
@@ -1,94 +0,0 @@
- [
- 'class' => AccessControl::className(),
- 'only' => ['logout'],
- 'rules' => [
- [
- 'actions' => ['logout'],
- 'allow' => true,
- 'roles' => ['@'],
- ],
- ],
- ],
- 'verbs' => [
- 'class' => VerbFilter::className(),
- 'actions' => [
- 'logout' => ['post'],
- ],
- ],
- ];
- }
-
- public function actions()
- {
- return [
- 'error' => [
- 'class' => 'yii\web\ErrorAction',
- ],
- 'captcha' => [
- 'class' => 'yii\captcha\CaptchaAction',
- 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
- ],
- ];
- }
-
- public function actionIndex()
- {
- return $this->render('index');
- }
-
- public function actionLogin()
- {
- if (!\Yii::$app->user->isGuest) {
- $this->goHome();
- }
-
- $model = new LoginForm();
- if ($model->load($_POST) && $model->login()) {
- return $this->goBack();
- } else {
- return $this->render('login', [
- 'model' => $model,
- ]);
- }
- }
-
- public function actionLogout()
- {
- Yii::$app->user->logout();
- return $this->goHome();
- }
-
- public function actionContact()
- {
- $model = new ContactForm;
- if ($model->load($_POST) && $model->contact(Yii::$app->params['adminEmail'])) {
- Yii::$app->session->setFlash('contactFormSubmitted');
- return $this->refresh();
- } else {
- return $this->render('contact', [
- 'model' => $model,
- ]);
- }
- }
-
- public function actionAbout()
- {
- return $this->render('about');
- }
-}
diff --git a/apps/basic/mails/layouts/html.php b/apps/basic/mails/layouts/html.php
deleted file mode 100644
index 2e6b615..0000000
--- a/apps/basic/mails/layouts/html.php
+++ /dev/null
@@ -1,24 +0,0 @@
-
-beginPage() ?>
-
-
-
-
- = Html::encode($this->title) ?>
- head() ?>
-
-
- beginBody() ?>
- = $content ?>
- endBody() ?>
-
-
-endPage() ?>
\ No newline at end of file
diff --git a/apps/basic/models/ContactForm.php b/apps/basic/models/ContactForm.php
deleted file mode 100644
index 1344562..0000000
--- a/apps/basic/models/ContactForm.php
+++ /dev/null
@@ -1,63 +0,0 @@
- 'Verification Code',
- ];
- }
-
- /**
- * Sends an email to the specified email address using the information collected by this model.
- * @param string $email the target email address
- * @return boolean whether the model passes validation
- */
- public function contact($email)
- {
- if ($this->validate()) {
- Yii::$app->mail->compose()
- ->setTo($email)
- ->setFrom([$this->email => $this->name])
- ->setSubject($this->subject)
- ->setTextBody($this->body)
- ->send();
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/apps/basic/models/LoginForm.php b/apps/basic/models/LoginForm.php
deleted file mode 100644
index d536443..0000000
--- a/apps/basic/models/LoginForm.php
+++ /dev/null
@@ -1,72 +0,0 @@
-getUser();
-
- if (!$user || !$user->validatePassword($this->password)) {
- $this->addError('password', 'Incorrect username or password.');
- }
- }
-
- /**
- * Logs in a user using the provided username and password.
- * @return boolean whether the user is logged in successfully
- */
- public function login()
- {
- if ($this->validate()) {
- return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0);
- } else {
- return false;
- }
- }
-
- /**
- * Finds user by [[username]]
- *
- * @return User|null
- */
- public function getUser()
- {
- if ($this->_user === false) {
- $this->_user = User::findByUsername($this->username);
- }
- return $this->_user;
- }
-}
diff --git a/apps/basic/models/User.php b/apps/basic/models/User.php
deleted file mode 100644
index af4c42e..0000000
--- a/apps/basic/models/User.php
+++ /dev/null
@@ -1,61 +0,0 @@
- [
- 'id' => '100',
- 'username' => 'admin',
- 'password' => 'admin',
- 'authKey' => 'test100key',
- ],
- '101' => [
- 'id' => '101',
- 'username' => 'demo',
- 'password' => 'demo',
- 'authKey' => 'test101key',
- ],
- ];
-
- public static function findIdentity($id)
- {
- return isset(self::$users[$id]) ? new static(self::$users[$id]) : null;
- }
-
- public static function findByUsername($username)
- {
- foreach (self::$users as $user) {
- if (strcasecmp($user['username'], $username) === 0) {
- return new static($user);
- }
- }
- return null;
- }
-
- public function getId()
- {
- return $this->id;
- }
-
- public function getAuthKey()
- {
- return $this->authKey;
- }
-
- public function validateAuthKey($authKey)
- {
- return $this->authKey === $authKey;
- }
-
- public function validatePassword($password)
- {
- return $this->password === $password;
- }
-}
diff --git a/apps/basic/requirements.php b/apps/basic/requirements.php
deleted file mode 100644
index 5c6495c..0000000
--- a/apps/basic/requirements.php
+++ /dev/null
@@ -1,110 +0,0 @@
-Error';
- echo 'The path to yii framework seems to be incorrect.
';
- echo 'You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) .'.
';
- echo 'Please refer to the README on how to install Yii.
';
-}
-
-require_once($frameworkPath . '/requirements/YiiRequirementChecker.php');
-$requirementsChecker = new YiiRequirementChecker();
-
-/**
- * Adjust requirements according to your application specifics.
- */
-$requirements = array(
- // Database :
- array(
- 'name' => 'PDO extension',
- 'mandatory' => true,
- 'condition' => extension_loaded('pdo'),
- 'by' => 'All DB-related classes',
- ),
- array(
- 'name' => 'PDO SQLite extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('pdo_sqlite'),
- 'by' => 'All DB-related classes',
- 'memo' => 'Required for SQLite database.',
- ),
- array(
- 'name' => 'PDO MySQL extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('pdo_mysql'),
- 'by' => 'All DB-related classes',
- 'memo' => 'Required for MySQL database.',
- ),
- array(
- 'name' => 'PDO PostgreSQL extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('pdo_pgsql'),
- 'by' => 'All DB-related classes',
- 'memo' => 'Required for PostgreSQL database.',
- ),
- // Cache :
- array(
- 'name' => 'Memcache extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('memcache') || extension_loaded('memcached'),
- 'by' => 'CMemCache',
- 'memo' => extension_loaded('memcached') ? 'To use memcached set CMemCache::useMemcached to true
.' : ''
- ),
- array(
- 'name' => 'APC extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('apc'),
- 'by' => 'CApcCache',
- ),
- // Additional PHP extensions :
- array(
- 'name' => 'Mcrypt extension',
- 'mandatory' => false,
- 'condition' => extension_loaded('mcrypt'),
- 'by' => 'CSecurityManager',
- 'memo' => 'Required by encrypt and decrypt methods.'
- ),
- // PHP ini :
- 'phpSafeMode' => array(
- 'name' => 'PHP safe mode',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"),
- 'by' => 'File uploading and console command execution',
- 'memo' => '"safe_mode" should be disabled at php.ini',
- ),
- 'phpExposePhp' => array(
- 'name' => 'Expose PHP',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
- 'by' => 'Security reasons',
- 'memo' => '"expose_php" should be disabled at php.ini',
- ),
- 'phpAllowUrlInclude' => array(
- 'name' => 'PHP allow url include',
- 'mandatory' => false,
- 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
- 'by' => 'Security reasons',
- 'memo' => '"allow_url_include" should be disabled at php.ini',
- ),
- 'phpSmtp' => array(
- 'name' => 'PHP mail SMTP',
- 'mandatory' => false,
- 'condition' => strlen(ini_get('SMTP'))>0,
- 'by' => 'Email sending',
- 'memo' => 'PHP mail SMTP server required',
- ),
-);
-$requirementsChecker->checkYii()->check($requirements)->render();
diff --git a/apps/basic/runtime/.gitignore b/apps/basic/runtime/.gitignore
deleted file mode 100644
index c96a04f..0000000
--- a/apps/basic/runtime/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/basic/tests/.gitignore b/apps/basic/tests/.gitignore
deleted file mode 100644
index c5aa074..0000000
--- a/apps/basic/tests/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-# these files are auto generated by codeception build
-/unit/CodeGuy.php
-/functional/TestGuy.php
-/acceptance/WebGuy.php
diff --git a/apps/basic/tests/README.md b/apps/basic/tests/README.md
deleted file mode 100644
index 83b0511..0000000
--- a/apps/basic/tests/README.md
+++ /dev/null
@@ -1,28 +0,0 @@
-This folder contains various tests for the basic application.
-These tests are developed with [Codeception PHP Testing Framework](http://codeception.com/).
-
-After creating the basic application, follow these steps to prepare for the tests:
-
-1. In the file `_bootstrap.php`, modify the definition of the constant `TEST_ENTRY_URL` so
- that it points to the correct entry script URL.
-2. Go to the application base directory and build the test suites:
-
- ```
- vendor/bin/codecept build
- ```
-
-Now you can run the tests with the following commands:
-
-```
-# run all available tests
-vendor/bin/codecept run
-# run acceptance tests
-vendor/bin/codecept run acceptance
-# run functional tests
-vendor/bin/codecept run functional
-# run unit tests
-vendor/bin/codecept run unit
-```
-
-Please refer to [Codeception tutorial](http://codeception.com/docs/01-Introduction) for
-more details about writing and running acceptance, functional and unit tests.
diff --git a/apps/basic/tests/_bootstrap.php b/apps/basic/tests/_bootstrap.php
deleted file mode 100644
index 07e86c7..0000000
--- a/apps/basic/tests/_bootstrap.php
+++ /dev/null
@@ -1,22 +0,0 @@
- [
- 'mail' => [
- 'useFileTransport' => true,
- ],
- 'urlManager' => [
- 'showScriptName' => true,
- ],
- ],
-];
diff --git a/apps/basic/tests/_data/dump.sql b/apps/basic/tests/_data/dump.sql
deleted file mode 100644
index 4bc742c..0000000
--- a/apps/basic/tests/_data/dump.sql
+++ /dev/null
@@ -1 +0,0 @@
-/* Replace this file with actual dump of your database */
\ No newline at end of file
diff --git a/apps/basic/tests/_helpers/CodeHelper.php b/apps/basic/tests/_helpers/CodeHelper.php
deleted file mode 100644
index 6448486..0000000
--- a/apps/basic/tests/_helpers/CodeHelper.php
+++ /dev/null
@@ -1,7 +0,0 @@
- $value) {
- $data["ContactForm[$name]"] = $value;
- }
- $this->guy->submitForm('#contact-form', $data);
- }
-}
diff --git a/apps/basic/tests/_pages/LoginPage.php b/apps/basic/tests/_pages/LoginPage.php
deleted file mode 100644
index aae5e0f..0000000
--- a/apps/basic/tests/_pages/LoginPage.php
+++ /dev/null
@@ -1,22 +0,0 @@
-guy->submitForm('#login-form', [
- 'LoginForm[username]' => $username,
- 'LoginForm[password]' => $password,
- ]);
- }
-}
diff --git a/apps/basic/tests/acceptance.suite.yml b/apps/basic/tests/acceptance.suite.yml
deleted file mode 100644
index 34e4397..0000000
--- a/apps/basic/tests/acceptance.suite.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-# Codeception Test Suite Configuration
-
-# suite for acceptance tests.
-# perform tests in browser using the Selenium-like tools.
-# powered by Mink (http://mink.behat.org).
-# (tip: that's what your customer will see).
-# (tip: test your ajax and javascript by one of Mink drivers).
-
-# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
-
-class_name: WebGuy
-modules:
- enabled:
- - WebHelper
- - PhpBrowser
-# you can use WebDriver instead of PhpBrowser to test javascript and ajax.
-# This will require you to install selenium. See http://codeception.com/docs/04-AcceptanceTests#Selenium
-# - WebDriver
- config:
- PhpBrowser:
- url: 'http://localhost:8080'
-# WebDriver:
-# url: 'http://localhost'
-# browser: firefox
diff --git a/apps/basic/tests/acceptance/AboutCept.php b/apps/basic/tests/acceptance/AboutCept.php
deleted file mode 100644
index deecee7..0000000
--- a/apps/basic/tests/acceptance/AboutCept.php
+++ /dev/null
@@ -1,8 +0,0 @@
-wantTo('ensure that about works');
-AboutPage::openBy($I);
-$I->see('About', 'h1');
diff --git a/apps/basic/tests/acceptance/ContactCept.php b/apps/basic/tests/acceptance/ContactCept.php
deleted file mode 100644
index 25f5735..0000000
--- a/apps/basic/tests/acceptance/ContactCept.php
+++ /dev/null
@@ -1,49 +0,0 @@
-wantTo('ensure that contact works');
-
-$contactPage = ContactPage::openBy($I);
-
-$I->see('Contact', 'h1');
-
-$I->amGoingTo('submit contact form with no data');
-$contactPage->submit([]);
-$I->expectTo('see validations errors');
-$I->see('Contact', 'h1');
-$I->see('Name cannot be blank');
-$I->see('Email cannot be blank');
-$I->see('Subject cannot be blank');
-$I->see('Body cannot be blank');
-$I->see('The verification code is incorrect');
-
-$I->amGoingTo('submit contact form with not correct email');
-$contactPage->submit([
- 'name' => 'tester',
- 'email' => 'tester.email',
- 'subject' => 'test subject',
- 'body' => 'test content',
- 'verifyCode' => 'testme',
-]);
-$I->expectTo('see that email adress is wrong');
-$I->dontSee('Name cannot be blank', '.help-inline');
-$I->see('Email is not a valid email address.');
-$I->dontSee('Subject cannot be blank', '.help-inline');
-$I->dontSee('Body cannot be blank', '.help-inline');
-$I->dontSee('The verification code is incorrect', '.help-inline');
-
-$I->amGoingTo('submit contact form with correct data');
-$contactPage->submit([
- 'name' => 'tester',
- 'email' => 'tester@example.com',
- 'subject' => 'test subject',
- 'body' => 'test content',
- 'verifyCode' => 'testme',
-]);
-if (method_exists($I, 'wait')) {
- $I->wait(3); // only for selenium
-}
-$I->dontSeeElement('#contact-form');
-$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
diff --git a/apps/basic/tests/acceptance/HomeCept.php b/apps/basic/tests/acceptance/HomeCept.php
deleted file mode 100644
index 62456f9..0000000
--- a/apps/basic/tests/acceptance/HomeCept.php
+++ /dev/null
@@ -1,9 +0,0 @@
-wantTo('ensure that home page works');
-$I->amOnPage(Yii::$app->homeUrl);
-$I->see('My Company');
-$I->seeLink('About');
-$I->click('About');
-$I->see('This is the About page.');
diff --git a/apps/basic/tests/acceptance/LoginCept.php b/apps/basic/tests/acceptance/LoginCept.php
deleted file mode 100644
index 5d6a387..0000000
--- a/apps/basic/tests/acceptance/LoginCept.php
+++ /dev/null
@@ -1,29 +0,0 @@
-wantTo('ensure that login works');
-
-$loginPage = LoginPage::openBy($I);
-
-$I->see('Login', 'h1');
-
-$I->amGoingTo('try to login with empty credentials');
-$loginPage->login('', '');
-$I->expectTo('see validations errors');
-$I->see('Username cannot be blank.');
-$I->see('Password cannot be blank.');
-
-$I->amGoingTo('try to login with wrong credentials');
-$loginPage->login('admin', 'wrong');
-$I->expectTo('see validations errors');
-$I->see('Incorrect username or password.');
-
-$I->amGoingTo('try to login with correct credentials');
-$loginPage->login('admin', 'admin');
-if (method_exists($I, 'wait')) {
- $I->wait(3); // only for selenium
-}
-$I->expectTo('see user info');
-$I->see('Logout (admin)');
diff --git a/apps/basic/tests/acceptance/_bootstrap.php b/apps/basic/tests/acceptance/_bootstrap.php
deleted file mode 100644
index 6ce3d17..0000000
--- a/apps/basic/tests/acceptance/_bootstrap.php
+++ /dev/null
@@ -1,3 +0,0 @@
- [
- 'db' => [
- 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance',
- ],
- ],
- ]
-);
diff --git a/apps/basic/tests/functional.suite.yml b/apps/basic/tests/functional.suite.yml
deleted file mode 100644
index 0d400af..0000000
--- a/apps/basic/tests/functional.suite.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-# Codeception Test Suite Configuration
-
-# suite for functional (integration) tests.
-# emulate web requests and make application process them.
-# (tip: better to use with frameworks).
-
-# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
-#basic/web/index.php
-class_name: TestGuy
-modules:
- enabled:
- - Filesystem
- - TestHelper
- - Yii2
- config:
- Yii2:
- configFile: 'tests/functional/_config.php'
diff --git a/apps/basic/tests/functional/AboutCept.php b/apps/basic/tests/functional/AboutCept.php
deleted file mode 100644
index 1875c2e..0000000
--- a/apps/basic/tests/functional/AboutCept.php
+++ /dev/null
@@ -1,8 +0,0 @@
-wantTo('ensure that about works');
-AboutPage::openBy($I);
-$I->see('About', 'h1');
diff --git a/apps/basic/tests/functional/ContactCept.php b/apps/basic/tests/functional/ContactCept.php
deleted file mode 100644
index 14e6197..0000000
--- a/apps/basic/tests/functional/ContactCept.php
+++ /dev/null
@@ -1,46 +0,0 @@
-wantTo('ensure that contact works');
-
-$contactPage = ContactPage::openBy($I);
-
-$I->see('Contact', 'h1');
-
-$I->amGoingTo('submit contact form with no data');
-$contactPage->submit([]);
-$I->expectTo('see validations errors');
-$I->see('Contact', 'h1');
-$I->see('Name cannot be blank');
-$I->see('Email cannot be blank');
-$I->see('Subject cannot be blank');
-$I->see('Body cannot be blank');
-$I->see('The verification code is incorrect');
-
-$I->amGoingTo('submit contact form with not correct email');
-$contactPage->submit([
- 'name' => 'tester',
- 'email' => 'tester.email',
- 'subject' => 'test subject',
- 'body' => 'test content',
- 'verifyCode' => 'testme',
-]);
-$I->expectTo('see that email adress is wrong');
-$I->dontSee('Name cannot be blank', '.help-inline');
-$I->see('Email is not a valid email address.');
-$I->dontSee('Subject cannot be blank', '.help-inline');
-$I->dontSee('Body cannot be blank', '.help-inline');
-$I->dontSee('The verification code is incorrect', '.help-inline');
-
-$I->amGoingTo('submit contact form with correct data');
-$contactPage->submit([
- 'name' => 'tester',
- 'email' => 'tester@example.com',
- 'subject' => 'test subject',
- 'body' => 'test content',
- 'verifyCode' => 'testme',
-]);
-$I->dontSeeElement('#contact-form');
-$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
diff --git a/apps/basic/tests/functional/HomeCept.php b/apps/basic/tests/functional/HomeCept.php
deleted file mode 100644
index 3258ba3..0000000
--- a/apps/basic/tests/functional/HomeCept.php
+++ /dev/null
@@ -1,9 +0,0 @@
-wantTo('ensure that home page works');
-$I->amOnPage(Yii::$app->homeUrl);
-$I->see('My Company');
-$I->seeLink('About');
-$I->click('About');
-$I->see('This is the About page.');
diff --git a/apps/basic/tests/functional/LoginCept.php b/apps/basic/tests/functional/LoginCept.php
deleted file mode 100644
index e5285cd..0000000
--- a/apps/basic/tests/functional/LoginCept.php
+++ /dev/null
@@ -1,26 +0,0 @@
-wantTo('ensure that login works');
-
-$loginPage = LoginPage::openBy($I);
-
-$I->see('Login', 'h1');
-
-$I->amGoingTo('try to login with empty credentials');
-$loginPage->login('', '');
-$I->expectTo('see validations errors');
-$I->see('Username cannot be blank.');
-$I->see('Password cannot be blank.');
-
-$I->amGoingTo('try to login with wrong credentials');
-$loginPage->login('admin', 'wrong');
-$I->expectTo('see validations errors');
-$I->see('Incorrect username or password.');
-
-$I->amGoingTo('try to login with correct credentials');
-$loginPage->login('admin', 'admin');
-$I->expectTo('see user info');
-$I->see('Logout (admin)');
diff --git a/apps/basic/tests/functional/_bootstrap.php b/apps/basic/tests/functional/_bootstrap.php
deleted file mode 100644
index 6ce3d17..0000000
--- a/apps/basic/tests/functional/_bootstrap.php
+++ /dev/null
@@ -1,3 +0,0 @@
- [
- 'db' => [
- 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional',
- ],
- ],
- ]
-);
diff --git a/apps/basic/tests/unit.suite.yml b/apps/basic/tests/unit.suite.yml
deleted file mode 100644
index be2874d..0000000
--- a/apps/basic/tests/unit.suite.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-# Codeception Test Suite Configuration
-
-# suite for unit (internal) tests.
-# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
-
-class_name: CodeGuy
-modules:
- enabled:
- - CodeHelper
diff --git a/apps/basic/tests/unit/_bootstrap.php b/apps/basic/tests/unit/_bootstrap.php
deleted file mode 100644
index 80cc72a..0000000
--- a/apps/basic/tests/unit/_bootstrap.php
+++ /dev/null
@@ -1,3 +0,0 @@
- [
- 'fixture' => [
- 'class' => 'yii\test\DbFixtureManager',
- 'basePath' => '@tests/unit/fixtures',
- ],
- 'db' => [
- 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit',
- ],
- ],
- ]
-);
diff --git a/apps/basic/tests/unit/fixtures/.gitkeep b/apps/basic/tests/unit/fixtures/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/apps/basic/tests/unit/models/ContactFormTest.php b/apps/basic/tests/unit/models/ContactFormTest.php
deleted file mode 100644
index 8c67567..0000000
--- a/apps/basic/tests/unit/models/ContactFormTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
-mail->fileTransportCallback = function ($mailer, $message) {
- return 'testing_message.eml';
- };
- }
-
- protected function tearDown()
- {
- unlink($this->getMessageFile());
- parent::tearDown();
- }
-
- public function testContact()
- {
- $model = $this->getMock('app\models\ContactForm', ['validate']);
- $model->expects($this->once())->method('validate')->will($this->returnValue(true));
-
- $model->attributes = [
- 'name' => 'Tester',
- 'email' => 'tester@example.com',
- 'subject' => 'very important letter subject',
- 'body' => 'body of current message',
- ];
-
- $model->contact('admin@example.com');
-
- $this->specify('email should be send', function () {
- $this->assertFileExists($this->getMessageFile(), 'email file should exist');
- });
-
- $this->specify('message should contain correct data', function () use($model) {
- $emailMessage = file_get_contents($this->getMessageFile());
- $this->assertContains($model->name, $emailMessage, 'email should contain user name');
- $this->assertContains($model->email, $emailMessage, 'email should contain sender email');
- $this->assertContains($model->subject, $emailMessage, 'email should contain subject');
- $this->assertContains($model->body, $emailMessage, 'email should contain body');
- });
- }
-
- private function getMessageFile()
- {
- return Yii::getAlias(Yii::$app->mail->fileTransportPath) . '/testing_message.eml';
- }
-
-}
diff --git a/apps/basic/tests/unit/models/LoginFormTest.php b/apps/basic/tests/unit/models/LoginFormTest.php
deleted file mode 100644
index f232a47..0000000
--- a/apps/basic/tests/unit/models/LoginFormTest.php
+++ /dev/null
@@ -1,62 +0,0 @@
-mockUser(null);
-
- $model->username = 'some_username';
- $model->password = 'some_password';
-
- $this->specify('user should not be able to login, when there is no identity' , function () use ($model) {
- $this->assertFalse($model->login());
- $this->assertTrue(Yii::$app->user->isGuest,'user should not be logged in');
- });
- }
-
- public function testLoginWrongPassword()
- {
- $model = $this->mockUser(new User);
-
- $model->username = 'demo';
- $model->password = 'wrong-password';
-
- $this->specify('user should not be able to login with wrong password', function () use ($model) {
- $this->assertFalse($model->login());
- $this->assertArrayHasKey('password',$model->errors);
- $this->assertTrue(Yii::$app->user->isGuest,'user should not be logged in');
- });
- }
-
- public function testLoginCorrect()
- {
- $model = $this->mockUser(new User(['password' => 'demo']));
-
- $model->username = 'demo';
- $model->password = 'demo';
-
- $this->specify('user should be able to login with correct credentials', function() use ($model) {
- $this->assertTrue($model->login());
- $this->assertArrayNotHasKey('password',$model->errors);
- $this->assertFalse(Yii::$app->user->isGuest,'user should be logged in');
- });
- }
-
- private function mockUser($user)
- {
- $loginForm = $this->getMock('app\models\LoginForm',['getUser']);
- $loginForm->expects($this->any())->method('getUser')->will($this->returnValue($user));
- return $loginForm;
- }
-
-}
\ No newline at end of file
diff --git a/apps/basic/tests/unit/models/UserTest.php b/apps/basic/tests/unit/models/UserTest.php
deleted file mode 100644
index 3ff3c83..0000000
--- a/apps/basic/tests/unit/models/UserTest.php
+++ /dev/null
@@ -1,20 +0,0 @@
-loadFixtures(['tbl_user']);
- }
-
- // TODO add test methods here
-}
diff --git a/apps/basic/tests/unit/templates/fixtures/.gitkeep b/apps/basic/tests/unit/templates/fixtures/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/apps/basic/vendor/.gitignore b/apps/basic/vendor/.gitignore
deleted file mode 100644
index c96a04f..0000000
--- a/apps/basic/vendor/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/basic/views/layouts/main.php b/apps/basic/views/layouts/main.php
deleted file mode 100644
index d1af295..0000000
--- a/apps/basic/views/layouts/main.php
+++ /dev/null
@@ -1,66 +0,0 @@
-
-beginPage() ?>
-
-
-
-
-
- = Html::encode($this->title) ?>
- head() ?>
-
-
-beginBody() ?>
- 'My Company',
- 'brandUrl' => Yii::$app->homeUrl,
- 'options' => [
- 'class' => 'navbar-inverse navbar-fixed-top',
- ],
- ]);
- echo Nav::widget([
- 'options' => ['class' => 'navbar-nav navbar-right'],
- 'items' => [
- ['label' => 'Home', 'url' => ['/site/index']],
- ['label' => 'About', 'url' => ['/site/about']],
- ['label' => 'Contact', 'url' => ['/site/contact']],
- Yii::$app->user->isGuest ?
- ['label' => 'Login', 'url' => ['/site/login']] :
- ['label' => 'Logout (' . Yii::$app->user->identity->username . ')' ,
- 'url' => ['/site/logout'],
- 'linkOptions' => ['data-method' => 'post']],
- ],
- ]);
- NavBar::end();
- ?>
-
-
- = Breadcrumbs::widget([
- 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
- ]) ?>
- = $content ?>
-
-
-
-
-endBody() ?>
-
-
-endPage() ?>
diff --git a/apps/basic/views/site/about.php b/apps/basic/views/site/about.php
deleted file mode 100644
index 0608dd2..0000000
--- a/apps/basic/views/site/about.php
+++ /dev/null
@@ -1,18 +0,0 @@
-title = 'About';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-
-
= Html::encode($this->title) ?>
-
-
- This is the About page. You may modify the following file to customize its content:
-
-
-
= __FILE__ ?>
-
diff --git a/apps/basic/views/site/contact.php b/apps/basic/views/site/contact.php
deleted file mode 100644
index ebd148e..0000000
--- a/apps/basic/views/site/contact.php
+++ /dev/null
@@ -1,47 +0,0 @@
-title = 'Contact';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-
diff --git a/apps/basic/views/site/error.php b/apps/basic/views/site/error.php
deleted file mode 100644
index 1b7ce04..0000000
--- a/apps/basic/views/site/error.php
+++ /dev/null
@@ -1,29 +0,0 @@
-title = $name;
-?>
-
-
-
= Html::encode($this->title) ?>
-
-
- = nl2br(Html::encode($message)) ?>
-
-
-
- The above error occurred while the Web server was processing your request.
-
-
- Please contact us if you think this is a server error. Thank you.
-
-
-
diff --git a/apps/basic/views/site/index.php b/apps/basic/views/site/index.php
deleted file mode 100644
index bcb2278..0000000
--- a/apps/basic/views/site/index.php
+++ /dev/null
@@ -1,53 +0,0 @@
-title = 'My Yii Application';
-?>
-
-
-
-
Congratulations!
-
-
You have successfully created your Yii-powered application.
-
-
Get started with Yii
-
-
-
-
-
-
-
Heading
-
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
- dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
- ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
- fugiat nulla pariatur.
-
-
Yii Documentation »
-
-
-
Heading
-
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
- dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
- ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
- fugiat nulla pariatur.
-
-
Yii Forum »
-
-
-
Heading
-
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
- dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
- ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
- fugiat nulla pariatur.
-
-
Yii Extensions »
-
-
-
-
-
diff --git a/apps/basic/views/site/login.php b/apps/basic/views/site/login.php
deleted file mode 100644
index da022d6..0000000
--- a/apps/basic/views/site/login.php
+++ /dev/null
@@ -1,47 +0,0 @@
-title = 'Login';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-
-
= Html::encode($this->title) ?>
-
-
Please fill out the following fields to login:
-
- 'login-form',
- 'options' => ['class' => 'form-horizontal'],
- 'fieldConfig' => [
- 'template' => "{label}\n
{input}
\n
{error}
",
- 'labelOptions' => ['class' => 'col-lg-1 control-label'],
- ],
- ]); ?>
-
- = $form->field($model, 'username') ?>
-
- = $form->field($model, 'password')->passwordInput() ?>
-
- = $form->field($model, 'rememberMe', [
- 'template' => "
{input}
\n
{error}
",
- ])->checkbox() ?>
-
-
-
-
-
-
- You may login with admin/admin or demo/demo.
- To modify the username/password, please check out the code app\models\User::$users
.
-
-
diff --git a/apps/basic/web/assets/.gitignore b/apps/basic/web/assets/.gitignore
deleted file mode 100644
index c96a04f..0000000
--- a/apps/basic/web/assets/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
\ No newline at end of file
diff --git a/apps/basic/web/css/site.css b/apps/basic/web/css/site.css
deleted file mode 100644
index a8508c4..0000000
--- a/apps/basic/web/css/site.css
+++ /dev/null
@@ -1,79 +0,0 @@
-body {
- padding-top: 70px;
-}
-
-.footer {
- border-top: 1px solid #ddd;
- margin-top: 30px;
- padding-top: 15px;
- padding-bottom: 30px;
-}
-
-.jumbotron {
- text-align: center;
- background-color: transparent;
-}
-
-.jumbotron .btn {
- font-size: 21px;
- padding: 14px 24px;
-}
-
-.not-set {
- color: #c55;
- font-style: italic;
-}
-
-/* add sorting icons to gridview sort links */
-a.asc:after, a.desc:after {
- position: relative;
- top: 1px;
- display: inline-block;
- font-family: 'Glyphicons Halflings';
- font-style: normal;
- font-weight: normal;
- line-height: 1;
- padding-left: 5px;
-}
-
-a.asc:after {
- content: /*"\e113"*/ "\e151";
-}
-
-a.desc:after {
- content: /*"\e114"*/ "\e152";
-}
-
-.sort-numerical a.asc:after {
- content: "\e153";
-}
-
-.sort-numerical a.desc:after {
- content: "\e154";
-}
-
-.sort-ordinal a.asc:after {
- content: "\e155";
-}
-
-.sort-ordinal a.desc:after {
- content: "\e156";
-}
-
-.grid-view th {
- white-space: nowrap;
-}
-
-.hint-block {
- display: block;
- margin-top: 5px;
- color: #999;
-}
-
-.error-summary {
- color: #a94442;
- background: #fdf7f7;
- border-left: 3px solid #eed3d7;
- padding: 10px 20px;
- margin: 0 0 15px 0;
-}
diff --git a/apps/basic/web/favicon.ico b/apps/basic/web/favicon.ico
deleted file mode 100644
index 49e61e3..0000000
Binary files a/apps/basic/web/favicon.ico and /dev/null differ
diff --git a/apps/basic/web/index-test.php b/apps/basic/web/index-test.php
deleted file mode 100644
index 2bec381..0000000
--- a/apps/basic/web/index-test.php
+++ /dev/null
@@ -1,16 +0,0 @@
-run();
diff --git a/apps/basic/web/index.php b/apps/basic/web/index.php
deleted file mode 100644
index 006e28f..0000000
--- a/apps/basic/web/index.php
+++ /dev/null
@@ -1,12 +0,0 @@
-run();
diff --git a/apps/basic/web/robots.txt b/apps/basic/web/robots.txt
deleted file mode 100644
index 6f27bb6..0000000
--- a/apps/basic/web/robots.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-User-agent: *
-Disallow:
\ No newline at end of file
diff --git a/apps/basic/yii b/apps/basic/yii
deleted file mode 100755
index 9188f85..0000000
--- a/apps/basic/yii
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env php
-run();
-exit($exitCode);
diff --git a/apps/basic/yii.bat b/apps/basic/yii.bat
deleted file mode 100644
index 5e21e2e..0000000
--- a/apps/basic/yii.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@echo off
-
-rem -------------------------------------------------------------
-rem Yii command line bootstrap script for Windows.
-rem
-rem @author Qiang Xue
-rem @link http://www.yiiframework.com/
-rem @copyright Copyright © 2012 Yii Software LLC
-rem @license http://www.yiiframework.com/license/
-rem -------------------------------------------------------------
-
-@setlocal
-
-set YII_PATH=%~dp0
-
-if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
-
-"%PHP_COMMAND%" "%YII_PATH%yii" %*
-
-@endlocal
diff --git a/apps/benchmark/LICENSE.md b/apps/benchmark/LICENSE.md
deleted file mode 100644
index e98f03d..0000000
--- a/apps/benchmark/LICENSE.md
+++ /dev/null
@@ -1,32 +0,0 @@
-The Yii framework is free software. It is released under the terms of
-the following BSD License.
-
-Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of Yii Software LLC nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/apps/benchmark/README.md b/apps/benchmark/README.md
deleted file mode 100644
index 27f598a..0000000
--- a/apps/benchmark/README.md
+++ /dev/null
@@ -1,58 +0,0 @@
-Yii 2 Benchmark Application
-===========================
-
-**NOTE** Yii 2 and the relevant applications and extensions are still under heavy
-development. We may make significant changes without prior notices. Please do not
-use them for production. Please consider using [Yii v1.1](https://github.com/yiisoft/yii)
-if you have a project to be deployed for production soon.
-
-
-Yii 2 Benchmark Application is an application built to demonstrate the minimal overhead
-introduced by the Yii framework. The application contains a single page which only renders
-the "hello world" string.
-
-The application attempts to simulate the scenario in which you can achieve the best performance
-when using Yii. It does so by assuming that both of the main application configuration and the page
-content are cached in memory, and the application enables pretty URLs.
-
-
-DIRECTORY STRUCTURE
--------------------
-
- protected/ contains application source code
- controllers/ contains Web controller classes
- index.php the entry script
-
-
-REQUIREMENTS
-------------
-
-The minimum requirement by Yii is that your Web server supports PHP 5.4.0.
-
-
-INSTALLATION
-------------
-
-If you do not have [Composer](http://getcomposer.org/), you may download it from
-[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS:
-
-~~~
-curl -s http://getcomposer.org/installer | php
-~~~
-
-You can then install the Bootstrap Application using the following command:
-
-~~~
-php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-benchmark yii-benchmark
-~~~
-
-Now you should be able to access the benchmark page using the URL
-
-~~~
-http://localhost/yii-benchmark/index.php/site/hello
-~~~
-
-In the above, we assume `yii-benchmark` is directly under the document root of your Web server.
-
-Note that in order to install some dependencies you must have `php_openssl` extension enabled.
-
diff --git a/apps/benchmark/composer.json b/apps/benchmark/composer.json
deleted file mode 100644
index d980f9a..0000000
--- a/apps/benchmark/composer.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name": "yiisoft/yii2-app-benchmark",
- "description": "Yii 2 Benchmark Application",
- "keywords": ["yii", "framework", "benchmark", "application"],
- "homepage": "http://www.yiiframework.com/",
- "type": "project",
- "license": "BSD-3-Clause",
- "support": {
- "issues": "https://github.com/yiisoft/yii2/issues?state=open",
- "forum": "http://www.yiiframework.com/forum/",
- "wiki": "http://www.yiiframework.com/wiki/",
- "irc": "irc://irc.freenode.net/yii",
- "source": "https://github.com/yiisoft/yii2"
- },
- "config": {
- "vendor-dir": "protected/vendor"
- },
- "minimum-stability": "dev",
- "require": {
- "php": ">=5.4.0",
- "yiisoft/yii2": "*"
- }
-}
diff --git a/apps/benchmark/index.php b/apps/benchmark/index.php
deleted file mode 100644
index 984beb2..0000000
--- a/apps/benchmark/index.php
+++ /dev/null
@@ -1,18 +0,0 @@
- 'benchmark',
- 'basePath' => __DIR__ . '/protected',
- 'components' => [
- 'urlManager' => [
- 'enablePrettyUrl' => true,
- ],
- ],
-];
-
-$application = new yii\web\Application($config);
-$application->run();
diff --git a/apps/benchmark/protected/.htaccess b/apps/benchmark/protected/.htaccess
deleted file mode 100644
index 8d2f256..0000000
--- a/apps/benchmark/protected/.htaccess
+++ /dev/null
@@ -1 +0,0 @@
-deny from all
diff --git a/apps/benchmark/protected/controllers/SiteController.php b/apps/benchmark/protected/controllers/SiteController.php
deleted file mode 100644
index 9abc164..0000000
--- a/apps/benchmark/protected/controllers/SiteController.php
+++ /dev/null
@@ -1,15 +0,0 @@
- 'yii-build',
- 'basePath' => __DIR__,
- 'controllerNamespace' => 'yii\build\controllers',
-]);
-$application->run();
diff --git a/build/build.bat b/build/build.bat
deleted file mode 100644
index e659199..0000000
--- a/build/build.bat
+++ /dev/null
@@ -1,23 +0,0 @@
-@echo off
-
-rem -------------------------------------------------------------
-rem build script for Windows.
-rem
-rem This is the bootstrap script for running build on Windows.
-rem
-rem @author Qiang Xue
-rem @link http://www.yiiframework.com/
-rem @copyright 2008 Yii Software LLC
-rem @license http://www.yiiframework.com/license/
-rem @version $Id$
-rem -------------------------------------------------------------
-
-@setlocal
-
-set BUILD_PATH=%~dp0
-
-if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
-
-%PHP_COMMAND% "%BUILD_PATH%build" %*
-
-@endlocal
\ No newline at end of file
diff --git a/build/build.xml b/build/build.xml
deleted file mode 100644
index 846e4cf..0000000
--- a/build/build.xml
+++ /dev/null
@@ -1,276 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Building package ${pkgname}...
- Copying files to build directory...
-
-
-
-
- Changing file permissions...
-
-
-
-
-
-
-
- Generating source release file...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Building documentation...
-
- Building Guide PDF...
-
-
-
-
-
-
- Building Blog PDF...
-
-
-
-
-
-
- Building API...
-
-
-
-
- Generating doc release file...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Building online API...
-
-
-
- Copying tutorials...
-
-
-
-
-
-
-
- Copying release text files...
-
-
-
-
-
-
-Finished building Web files.
-Please update yiisite/common/data/versions.php file with the following code:
-
- '1.1'=>array(
- 'version'=>'${yii.version}',
- 'revision'=>'${yii.revision}',
- 'date'=>'${yii.date}',
- 'latest'=>true,
- ),
-
-
-
-
-
- Synchronizing code changes for ${pkgname}...
-
- Building autoload map...
-
-
- Building yiilite.php...
-
-
-
-
- Extracting i18n messages...
-
-
-
-
-
-
- Cleaning up the build...
-
-
-
-
-
-
- Welcome to use Yii build script!
- --------------------------------
- You may use the following command format to build a target:
-
- phing <target name>
-
- where <target name> can be one of the following:
-
- - sync : synchronize yiilite.php and BaseYii.php
- - message : extract i18n messages of the framework
- - src : build source release
- - doc : build documentation release (Windows only)
- - clean : clean up the build
-
-
-
-
diff --git a/build/controllers/ClassmapController.php b/build/controllers/ClassmapController.php
deleted file mode 100644
index a0ba886..0000000
--- a/build/controllers/ClassmapController.php
+++ /dev/null
@@ -1,88 +0,0 @@
-
- * @since 2.0
- */
-class ClassmapController extends Controller
-{
- public $defaultAction = 'create';
-
- /**
- * Creates a class map for the core Yii classes.
- * @param string $root the root path of Yii framework. Defaults to YII_PATH.
- * @param string $mapFile the file to contain the class map. Defaults to YII_PATH . '/classes.php'.
- */
- public function actionCreate($root = null, $mapFile = null)
- {
- if ($root === null) {
- $root = YII_PATH;
- }
- $root = FileHelper::normalizePath($root);
- if ($mapFile === null) {
- $mapFile = YII_PATH . '/classes.php';
- }
- $options = [
- 'filter' => function ($path) {
- if (is_file($path)) {
- $file = basename($path);
- if ($file[0] < 'A' || $file[0] > 'Z') {
- return false;
- }
- }
- return null;
- },
- 'only' => ['.php'],
- 'except' => [
- 'Yii.php',
- 'BaseYii.php',
- '/console/',
- ],
- ];
- $files = FileHelper::findFiles($root, $options);
- $map = [];
- foreach ($files as $file) {
- if (($pos = strpos($file, $root)) !== 0) {
- die("Something wrong: $file\n");
- }
- $path = str_replace('\\', '/', substr($file, strlen($root)));
- $map[$path] = "\t'yii" . substr(str_replace('/', '\\', $path), 0, -4) . "' => YII_PATH . '$path',";
- }
- ksort($map);
- $map = implode("\n", $map);
- $output = <<
- * @author Alexander Makarov
- * @since 2.0
- */
-class PhpDocController extends Controller
-{
- public $defaultAction = 'property';
-
- /**
- * @var bool whether to update class docs directly. Setting this to false will just output docs
- * for copy and paste.
- */
- public $updateFiles = true;
-
- /**
- * Generates @property annotations in class files from getters and setters
- *
- * Property description will be taken from getter or setter or from an @property annotation
- * in the getters docblock if there is one defined.
- *
- * See https://github.com/yiisoft/yii2/wiki/Core-framework-code-style#documentation for details.
- *
- * @param null $root the directory to parse files from. Defaults to YII_PATH.
- */
- public function actionProperty($root = null)
- {
- $except = [];
- if ($root === null) {
- $root = dirname(dirname(YII_PATH));
- $extensionPath = "$root/extensions/yii";
- foreach (scandir($extensionPath) as $extension) {
- if (ctype_alpha($extension) && is_dir($extensionPath . '/' . $extension)) {
- Yii::setAlias("@yii/$extension", "$extensionPath/$extension");
- }
- }
-
- $except = [
- '/apps/',
- '/build/',
- '/docs/',
- '/extensions/yii/composer/',
- '/tests/',
- '/vendor/',
- ];
- }
- $root = FileHelper::normalizePath($root);
- $options = [
- 'filter' => function ($path) {
- if (is_file($path)) {
- $file = basename($path);
- if ($file[0] < 'A' || $file[0] > 'Z') {
- return false;
- }
- }
- return null;
- },
- 'only' => ['.php'],
- 'except' => array_merge($except, [
- 'BaseYii.php',
- 'Yii.php',
- '/views/',
- '/requirements/',
- '/gii/generators/',
- ]),
- ];
- $files = FileHelper::findFiles($root, $options);
- $nFilesTotal = 0;
- $nFilesUpdated = 0;
- foreach ($files as $file) {
- $result = $this->generateClassPropertyDocs($file);
- if ($result !== false) {
- list($className, $phpdoc) = $result;
- if ($this->updateFiles) {
- if ($this->updateClassPropertyDocs($file, $className, $phpdoc)) {
- $nFilesUpdated++;
- }
- } elseif (!empty($phpdoc)) {
- $this->stdout("\n[ " . $file . " ]\n\n", Console::BOLD);
- $this->stdout($phpdoc);
- }
- }
- $nFilesTotal++;
- }
-
- $this->stdout("\nParsed $nFilesTotal files.\n");
- $this->stdout("Updated $nFilesUpdated files.\n");
- }
-
- public function globalOptions()
- {
- return array_merge(parent::globalOptions(), ['updateFiles']);
- }
-
- protected function updateClassPropertyDocs($file, $className, $propertyDoc)
- {
- $ref = new \ReflectionClass($className);
- if ($ref->getFileName() != $file) {
- $this->stderr("[ERR] Unable to create ReflectionClass for class: $className loaded class is not from file: $file\n", Console::FG_RED);
- }
-
- if (!$ref->isSubclassOf('yii\base\Object') && $className != 'yii\base\Object') {
- $this->stderr("[INFO] Skipping class $className as it is not a subclass of yii\\base\\Object.\n", Console::FG_BLUE, Console::BOLD);
- return false;
- }
-
- $oldDoc = $ref->getDocComment();
- $newDoc = $this->cleanDocComment($this->updateDocComment($oldDoc, $propertyDoc));
-
- $seenSince = false;
- $seenAuthor = false;
-
- // TODO move these checks to different action
- $lines = explode("\n", $newDoc);
- if (trim($lines[1]) == '*' || substr(trim($lines[1]), 0, 3) == '* @') {
- $this->stderr("[WARN] Class $className has no short description.\n", Console::FG_YELLOW, Console::BOLD);
- }
- foreach ($lines as $line) {
- if (substr(trim($line), 0, 9) == '* @since ') {
- $seenSince = true;
- } elseif (substr(trim($line), 0, 10) == '* @author ') {
- $seenAuthor = true;
- }
- }
-
- if (!$seenSince) {
- $this->stderr("[ERR] No @since found in class doc in file: $file\n", Console::FG_RED);
- }
- if (!$seenAuthor) {
- $this->stderr("[ERR] No @author found in class doc in file: $file\n", Console::FG_RED);
- }
-
- if (trim($oldDoc) != trim($newDoc)) {
-
- $fileContent = explode("\n", file_get_contents($file));
- $start = $ref->getStartLine() - 2;
- $docStart = $start - count(explode("\n", $oldDoc)) + 1;
-
- $newFileContent = [];
- $n = count($fileContent);
- for ($i = 0; $i < $n; $i++) {
- if ($i > $start || $i < $docStart) {
- $newFileContent[] = $fileContent[$i];
- } else {
- $newFileContent[] = trim($newDoc);
- $i = $start;
- }
- }
-
- file_put_contents($file, implode("\n", $newFileContent));
-
- return true;
- }
- return false;
- }
-
- /**
- * remove multi empty lines and trim trailing whitespace
- *
- * @param $doc
- * @return string
- */
- protected function cleanDocComment($doc)
- {
- $lines = explode("\n", $doc);
- $n = count($lines);
- for ($i = 0; $i < $n; $i++) {
- $lines[$i] = rtrim($lines[$i]);
- if (trim($lines[$i]) == '*' && trim($lines[$i + 1]) == '*') {
- unset($lines[$i]);
- }
- }
- return implode("\n", $lines);
- }
-
- /**
- * replace property annotations in doc comment
- * @param $doc
- * @param $properties
- * @return string
- */
- protected function updateDocComment($doc, $properties)
- {
- $lines = explode("\n", $doc);
- $propertyPart = false;
- $propertyPosition = false;
- foreach ($lines as $i => $line) {
- if (substr(trim($line), 0, 12) == '* @property ') {
- $propertyPart = true;
- } elseif ($propertyPart && trim($line) == '*') {
- $propertyPosition = $i;
- $propertyPart = false;
- }
- if (substr(trim($line), 0, 10) == '* @author ' && $propertyPosition === false) {
- $propertyPosition = $i - 1;
- $propertyPart = false;
- }
- if ($propertyPart) {
- unset($lines[$i]);
- }
- }
- $finalDoc = '';
- foreach ($lines as $i => $line) {
- $finalDoc .= $line . "\n";
- if ($i == $propertyPosition) {
- $finalDoc .= $properties;
- }
- }
- return $finalDoc;
- }
-
- protected function generateClassPropertyDocs($fileName)
- {
- $phpdoc = "";
- $file = str_replace("\r", "", str_replace("\t", " ", file_get_contents($fileName, true)));
- $ns = $this->match('#\nnamespace (?[\w\\\\]+);\n#', $file);
- $namespace = reset($ns);
- $namespace = $namespace['name'];
- $classes = $this->match('#\n(?:abstract )?class (?\w+)( extends .+)?( implements .+)?\n\{(?.*)\n\}(\n|$)#', $file);
-
- if (count($classes) > 1) {
- $this->stderr("[ERR] There should be only one class in a file: $fileName\n", Console::FG_RED);
- return false;
- }
- if (count($classes) < 1) {
- $interfaces = $this->match('#\ninterface (?\w+)( extends .+)?\n\{(?.+)\n\}(\n|$)#', $file);
- if (count($interfaces) == 1) {
- return false;
- } elseif (count($interfaces) > 1) {
- $this->stderr("[ERR] There should be only one interface in a file: $fileName\n", Console::FG_RED);
- } else {
- $traits = $this->match('#\ntrait (?\w+)\n\{(?.+)\n\}(\n|$)#', $file);
- if (count($traits) == 1) {
- return false;
- } elseif (count($traits) > 1) {
- $this->stderr("[ERR] There should be only one class/trait/interface in a file: $fileName\n", Console::FG_RED);
- } else {
- $this->stderr("[ERR] No class in file: $fileName\n", Console::FG_RED);
- }
- }
- return false;
- }
-
- $className = null;
- foreach ($classes as &$class) {
-
- $className = $namespace . '\\' . $class['name'];
-
- $gets = $this->match(
- '#\* @return (?[\w\\|\\\\\\[\\]]+)(?: (?(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' .
- '[\s\n]{2,}public function (?get)(?\w+)\((?:,? ?\$\w+ ?= ?[^,]+)*\)#',
- $class['content']);
- $sets = $this->match(
- '#\* @param (?[\w\\|\\\\\\[\\]]+) \$\w+(?: (?(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' .
- '[\s\n]{2,}public function (?set)(?\w+)\(\$\w+(?:, ?\$\w+ ?= ?[^,]+)*\)#',
- $class['content']);
- // check for @property annotations in getter and setter
- $properties = $this->match(
- '#\* @(?property) (?[\w\\|\\\\\\[\\]]+)(?: (?(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' .
- '[\s\n]{2,}public function [g|s]et(?\w+)\(((?:,? ?\$\w+ ?= ?[^,]+)*|\$\w+(?:, ?\$\w+ ?= ?[^,]+)*)\)#',
- $class['content']);
- $acrs = array_merge($properties, $gets, $sets);
-
- $props = [];
- foreach ($acrs as &$acr) {
- $acr['name'] = lcfirst($acr['name']);
- $acr['comment'] = trim(preg_replace('#(^|\n)\s+\*\s?#', '$1 * ', $acr['comment']));
- $props[$acr['name']][$acr['kind']] = [
- 'type' => $acr['type'],
- 'comment' => $this->fixSentence($acr['comment']),
- ];
- }
-
- ksort($props);
-
- if (count($props) > 0) {
- $phpdoc .= " *\n";
- foreach ($props as $propName => &$prop) {
- $docline = ' * @';
- $docline .= 'property'; // Do not use property-read and property-write as few IDEs support complex syntax.
- $note = '';
- if (isset($prop['get']) && isset($prop['set'])) {
- if ($prop['get']['type'] != $prop['set']['type']) {
- $note = ' Note that the type of this property differs in getter and setter.'
- . ' See [[get'.ucfirst($propName).'()]] and [[set'.ucfirst($propName).'()]] for details.';
- }
- } elseif (isset($prop['get'])) {
- // check if parent class has setter defined
- $c = $className;
- $parentSetter = false;
- while($parent = get_parent_class($c)) {
- if (method_exists($parent, 'set' . ucfirst($propName))) {
- $parentSetter = true;
- break;
- }
- $c = $parent;
- }
- if (!$parentSetter) {
- $note = ' This property is read-only.';
-// $docline .= '-read';
- }
- } elseif (isset($prop['set'])) {
- // check if parent class has getter defined
- $c = $className;
- $parentGetter = false;
- while($parent = get_parent_class($c)) {
- if (method_exists($parent, 'set' . ucfirst($propName))) {
- $parentGetter = true;
- break;
- }
- $c = $parent;
- }
- if (!$parentGetter) {
- $note = ' This property is write-only.';
-// $docline .= '-write';
- }
- } else {
- continue;
- }
- $docline .= ' ' . $this->getPropParam($prop, 'type') . " $$propName ";
- $comment = explode("\n", $this->getPropParam($prop, 'comment') . $note);
- foreach ($comment as &$cline) {
- $cline = ltrim($cline, '* ');
- }
- $docline = wordwrap($docline . implode(' ', $comment), 110, "\n * ") . "\n";
-
- $phpdoc .= $docline;
- }
- $phpdoc .= " *\n";
- }
- }
- return [$className, $phpdoc];
- }
-
- protected function match($pattern, $subject)
- {
- $sets = [];
- preg_match_all($pattern . 'suU', $subject, $sets, PREG_SET_ORDER);
- foreach ($sets as &$set)
- foreach ($set as $i => $match)
- if (is_numeric($i) /*&& $i != 0*/)
- unset($set[$i]);
- return $sets;
- }
-
- protected function fixSentence($str)
- {
- // TODO fix word wrap
- if ($str == '')
- return '';
- return strtoupper(substr($str, 0, 1)) . substr($str, 1) . ($str[strlen($str) - 1] != '.' ? '.' : '');
- }
-
- protected function getPropParam($prop, $param)
- {
- return isset($prop['property']) ? $prop['property'][$param] : (isset($prop['get']) ? $prop['get'][$param] : $prop['set'][$param]);
- }
-}
diff --git a/composer.json b/composer.json
index 368c817..e2a99df 100644
--- a/composer.json
+++ b/composer.json
@@ -1,121 +1,27 @@
{
- "name": "yiisoft/yii2-dev",
- "description": "Yii PHP Framework Version 2 - Development Package",
- "keywords": ["yii", "framework"],
- "homepage": "http://www.yiiframework.com/",
+ "name": "yiisoft/yii2-bootstrap",
+ "description": "The Twitter Bootstrap extension for the Yii framework",
+ "keywords": ["yii", "bootstrap"],
"type": "yii2-extension",
"license": "BSD-3-Clause",
- "authors": [
- {
- "name": "Qiang Xue",
- "email": "qiang.xue@gmail.com",
- "homepage": "http://www.yiiframework.com/",
- "role": "Founder and project lead"
- },
- {
- "name": "Alexander Makarov",
- "email": "sam@rmcreative.ru",
- "homepage": "http://rmcreative.ru/",
- "role": "Core framework development"
- },
- {
- "name": "Maurizio Domba",
- "homepage": "http://mdomba.info/",
- "role": "Core framework development"
- },
- {
- "name": "Carsten Brandt",
- "email": "mail@cebe.cc",
- "homepage": "http://cebe.cc/",
- "role": "Core framework development"
- },
- {
- "name": "Timur Ruziev",
- "email": "resurtm@gmail.com",
- "homepage": "http://resurtm.com/",
- "role": "Core framework development"
- },
- {
- "name": "Paul Klimov",
- "email": "klimov.paul@gmail.com",
- "role": "Core framework development"
- }
- ],
"support": {
- "issues": "https://github.com/yiisoft/yii2/issues?state=open",
+ "issues": "https://github.com/yiisoft/yii2/issues?labels=ext%3Abootstrap",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
- "minimum-stability": "dev",
- "replace": {
- "yiisoft/yii2-apidoc": "self.version",
- "yiisoft/yii2-authclient": "self.version",
- "yiisoft/yii2-bootstrap": "self.version",
- "yiisoft/yii2-codeception": "self.version",
- "yiisoft/yii2-debug": "self.version",
- "yiisoft/yii2-elasticsearch": "self.version",
- "yiisoft/yii2-faker": "self.version",
- "yiisoft/yii2-imagine": "self.version",
- "yiisoft/yii2-gii": "self.version",
- "yiisoft/yii2-jui": "self.version",
- "yiisoft/yii2-mongodb": "self.version",
- "yiisoft/yii2-redis": "self.version",
- "yiisoft/yii2-smarty": "self.version",
- "yiisoft/yii2-swiftmailer": "self.version",
- "yiisoft/yii2-sphinx": "self.version",
- "yiisoft/yii2-twig": "self.version",
- "yiisoft/yii2": "self.version"
- },
+ "authors": [
+ {
+ "name": "Qiang Xue",
+ "email": "qiang.xue@gmail.com"
+ }
+ ],
"require": {
- "php": ">=5.4.0",
- "ext-mbstring": "*",
- "lib-pcre": "*",
- "yiisoft/yii2-composer": "*",
- "yiisoft/jquery": "1.10.*",
- "phpspec/php-diff": ">=1.0.2",
- "ezyang/htmlpurifier": "4.6.*",
- "michelf/php-markdown": "1.3.*"
- },
- "require-dev": {
- "phpunit/phpunit": "3.7.*",
- "twig/twig": "*"
- },
- "suggest": {
- "phpdocumentor/reflection": "required by yii2-apidoc extension",
- "twbs/bootstrap": "required by yii2-bootstrap, yii2-debug, yii2-gii extension",
- "ext-curl": "required by yii2-elasticsearch extension",
- "ext-mongo": "required by yii2-mongo extension",
- "ext-pdo": "required by yii2-sphinx extension",
- "ext-pdo_mysql": "required by yii2-sphinx extension",
- "fzaninotto/faker": "required by yii2-faker extension",
- "imagine/imagine": "required by yii2-imagine extension",
- "smarty/smarty": "required by yii2-smarty extension",
- "swiftmailer/swiftmailer": "required by yii2-swiftmailer extension",
- "twig/twig": "required by yii2-twig extension"
+ "yiisoft/yii2": "*",
+ "twbs/bootstrap": "3.0.*"
},
"autoload": {
- "psr-4": {
- "yii\\faker\\": "extensions/faker/",
- "yii\\twig\\": "extensions/twig/"
- },
- "psr-0": {
- "yii\\apidoc\\": "extensions/",
- "yii\\authclient\\": "extensions/",
- "yii\\bootstrap\\": "extensions/",
- "yii\\codeception\\": "extensions/",
- "yii\\debug\\": "extensions/",
- "yii\\elasticsearch\\": "extensions/",
- "yii\\gii\\": "extensions/",
- "yii\\imagine\\" : "extensions/",
- "yii\\jui\\": "extensions/",
- "yii\\mongodb\\": "extensions/",
- "yii\\redis\\": "extensions/",
- "yii\\smarty\\": "extensions/",
- "yii\\swiftmailer\\": "extensions/",
- "yii\\sphinx\\": "extensions/",
- "yii\\": "framework/"
- }
+ "psr-4": { "yii\\bootstrap\\": "" }
}
}
diff --git a/docs/api/base/Component.md b/docs/api/base/Component.md
deleted file mode 100644
index f198798..0000000
--- a/docs/api/base/Component.md
+++ /dev/null
@@ -1,80 +0,0 @@
-Component is the base class that implements the *property*, *event* and *behavior* features.
-
-Component provides the *event* and *behavior* features, in addition to the *property* feature which is implemented in
-its parent class [[Object]].
-
-Event is a way to "inject" custom code into existing code at certain places. For example, a comment object can trigger
-an "add" event when the user adds a comment. We can write custom code and attach it to this event so that when the event
-is triggered (i.e. comment will be added), our custom code will be executed.
-
-An event is identified by a name that should be unique within the class it is defined at. Event names are *case-sensitive*.
-
-One or multiple PHP callbacks, called *event handlers*, can be attached to an event. You can call [[trigger()]] to
-raise an event. When an event is raised, the event handlers will be invoked automatically in the order they were
-attached.
-
-To attach an event handler to an event, call [[on()]]:
-
-~~~
-$post->on('update', function($event) {
- // send email notification
-});
-~~~
-
-In the above, an anonymous function is attached to the "update" event of the post. You may attach
-the following types of event handlers:
-
-- anonymous function: `function($event) { ... }`
-- object method: `[$object, 'handleAdd']`
-- static class method: `['Page', 'handleAdd']`
-- global function: `'handleAdd'`
-
-The signature of an event handler should be like the following:
-
-~~~
-function foo($event)
-~~~
-
-where `$event` is an [[Event]] object which includes parameters associated with the event.
-
-You can also attach a handler to an event when configuring a component with a configuration array.
-The syntax is like the following:
-
-~~~
-[
- 'on add' => function($event) { ... }
-]
-~~~
-
-where `on add` stands for attaching an event to the `add` event.
-
-Sometimes, you may want to associate extra data with an event handler when you attach it to an event
-and then access it when the handler is invoked. You may do so by
-
-~~~
-$post->on('update', function($event) {
- // the data can be accessed via $event->data
-}, $data);
-~~~
-
-
-A behavior is an instance of [[Behavior]] or its child class. A component can be attached with one or multiple
-behaviors. When a behavior is attached to a component, its public properties and methods can be accessed via the
-component directly, as if the component owns those properties and methods.
-
-To attach a behavior to a component, declare it in [[behaviors()]], or explicitly call [[attachBehavior]]. Behaviors
-declared in [[behaviors()]] are automatically attached to the corresponding component.
-
-One can also attach a behavior to a component when configuring it with a configuration array. The syntax is like the
-following:
-
-~~~
-[
- 'as tree' => [
- 'class' => 'Tree',
- ],
-]
-~~~
-
-where `as tree` stands for attaching a behavior named `tree`, and the array will be passed to [[\Yii::createObject()]]
-to create the behavior object.
\ No newline at end of file
diff --git a/docs/api/base/Object.md b/docs/api/base/Object.md
deleted file mode 100644
index a6ab2c1..0000000
--- a/docs/api/base/Object.md
+++ /dev/null
@@ -1,61 +0,0 @@
-Object is the base class that implements the *property* feature.
-
-A property is defined by a getter method (e.g. `getLabel`), and/or a setter method (e.g. `setLabel`). For example,
-the following getter and setter methods define a property named `label`:
-
-~~~
-private $_label;
-
-public function getLabel()
-{
- return $this->_label;
-}
-
-public function setLabel($value)
-{
- $this->_label = $value;
-}
-~~~
-
-Property names are *case-insensitive*.
-
-A property can be accessed like a member variable of an object. Reading or writing a property will cause the invocation
-of the corresponding getter or setter method. For example,
-
-~~~
-// equivalent to $label = $object->getLabel();
-$label = $object->label;
-// equivalent to $object->setLabel('abc');
-$object->label = 'abc';
-~~~
-
-If a property has only a getter method and has no setter method, it is considered as *read-only*. In this case, trying
-to modify the property value will cause an exception.
-
-One can call [[hasProperty()]], [[canGetProperty()]] and/or [[canSetProperty()]] to check the existence of a property.
-
-
-Besides the property feature, Object also introduces an important object initialization life cycle. In particular,
-creating an new instance of Object or its derived class will involve the following life cycles sequentially:
-
-1. the class constructor is invoked;
-2. object properties are initialized according to the given configuration;
-3. the `init()` method is invoked.
-
-In the above, both Step 2 and 3 occur at the end of the class constructor. It is recommended that
-you perform object initialization in the `init()` method because at that stage, the object configuration
-is already applied.
-
-In order to ensure the above life cycles, if a child class of Object needs to override the constructor,
-it should be done like the following:
-
-~~~
-public function __construct($param1, $param2, ..., $config = [])
-{
- ...
- parent::__construct($config);
-}
-~~~
-
-That is, a `$config` parameter (defaults to `[]`) should be declared as the last parameter
-of the constructor, and the parent implementation should be called at the end of the constructor.
diff --git a/docs/api/db/ActiveRecord-find.md b/docs/api/db/ActiveRecord-find.md
deleted file mode 100644
index 8653853..0000000
--- a/docs/api/db/ActiveRecord-find.md
+++ /dev/null
@@ -1,26 +0,0 @@
-The returned [[ActiveQuery]] instance can be further customized by calling
-methods defined in [[ActiveQuery]] before `one()`, `all()` or `value()` is
-called to return the populated active records:
-
-~~~
-// find all customers
-$customers = Customer::find()->all();
-
-// find all active customers and order them by their age:
-$customers = Customer::find()
- ->where(['status' => 1])
- ->orderBy('age')
- ->all();
-
-// find a single customer whose primary key value is 10
-$customer = Customer::find(10);
-
-// the above is equivalent to:
-$customer = Customer::find()->where(['id' => 10])->one();
-
-// find a single customer whose age is 30 and whose status is 1
-$customer = Customer::find(['age' => 30, 'status' => 1]);
-
-// the above is equivalent to:
-$customer = Customer::find()->where(['age' => 30, 'status' => 1])->one();
-~~~
\ No newline at end of file
diff --git a/docs/api/db/ActiveRecord.md b/docs/api/db/ActiveRecord.md
deleted file mode 100644
index ef050d0..0000000
--- a/docs/api/db/ActiveRecord.md
+++ /dev/null
@@ -1,451 +0,0 @@
-ActiveRecord implements the [Active Record design pattern](http://en.wikipedia.org/wiki/Active_record).
-The idea is that an ActiveRecord object is associated with a row in a database table
-so object properties are mapped to columns of the corresponding database row.
-For example, a `Customer` object is associated with a row in the `tbl_customer`
-table. Instead of writing raw SQL statements to access the data in the table,
-you can call intuitive methods available in the corresponding ActiveRecord class
-to achieve the same goals. For example, calling [[save()]] would insert or update a row
-in the underlying table:
-
-~~~
-$customer = new Customer();
-$customer->name = 'Qiang';
-$customer->save();
-~~~
-
-
-### Declaring ActiveRecord Classes
-
-To declare an ActiveRecord class you need to extend [[\yii\db\ActiveRecord]] and
-implement `tableName` method like the following:
-
-~~~
-class Customer extends \yii\db\ActiveRecord
-{
- /**
- * @return string the name of the table associated with this ActiveRecord class.
- */
- public static function tableName()
- {
- return 'tbl_customer';
- }
-}
-~~~
-
-### Connecting to Database
-
-ActiveRecord relies on a [[Connection|DB connection]]. By default, it assumes that
-there is an application component named `db` that gives the needed [[Connection]]
-instance which serves as the DB connection. Usually this component is configured
-via application configuration like the following:
-
-~~~
-return [
- 'components' => [
- 'db' => [
- 'class' => 'yii\db\Connection',
- 'dsn' => 'mysql:host=localhost;dbname=testdb',
- 'username' => 'demo',
- 'password' => 'demo',
- // turn on schema caching to improve performance
- // 'schemaCacheDuration' => 3600,
- ],
- ],
-];
-~~~
-
-
-### Getting Data from Database
-
-There are two ActiveRecord methods for getting data:
-
-- [[find()]]
-- [[findBySql()]]
-
-They both return an [[ActiveQuery]] instance. Coupled with the various customization and query methods
-provided by [[ActiveQuery]], ActiveRecord supports very flexible and powerful data retrieval approaches.
-
-The followings are some examples,
-
-~~~
-// to retrieve all *active* customers and order them by their ID:
-$customers = Customer::find()
- ->where(['status' => $active])
- ->orderBy('id')
- ->all();
-
-// to return a single customer whose ID is 1:
-$customer = Customer::find()
- ->where(['id' => 1])
- ->one();
-
-// or use the following shortcut approach:
-$customer = Customer::find(1);
-
-// to retrieve customers using a raw SQL statement:
-$sql = 'SELECT * FROM tbl_customer';
-$customers = Customer::findBySql($sql)->all();
-
-// to return the number of *active* customers:
-$count = Customer::find()
- ->where(['status' => $active])
- ->count();
-
-// to return customers in terms of arrays rather than `Customer` objects:
-$customers = Customer::find()->asArray()->all();
-// each $customers element is an array of name-value pairs
-
-// to index the result by customer IDs:
-$customers = Customer::find()->indexBy('id')->all();
-// $customers array is indexed by customer IDs
-~~~
-
-
-### Accessing Column Data
-
-ActiveRecord maps each column of the corresponding database table row to an *attribute* in the ActiveRecord
-object. An attribute is like a regular object property whose name is the same as the corresponding column
-name and is case sensitive.
-
-To read the value of a column, we can use the following expression:
-
-~~~
-// "id" is the name of a column in the table associated with $customer ActiveRecord object
-$id = $customer->id;
-// or alternatively,
-$id = $customer->getAttribute('id');
-~~~
-
-We can get all column values through the [[attributes]] property:
-
-~~~
-$values = $customer->attributes;
-~~~
-
-
-### Persisting Data to Database
-
-ActiveRecord provides the following methods to insert, update and delete data:
-
-- [[save()]]
-- [[insert()]]
-- [[update()]]
-- [[delete()]]
-- [[updateCounters()]]
-- [[updateAll()]]
-- [[updateAllCounters()]]
-- [[deleteAll()]]
-
-Note that [[updateAll()]], [[updateAllCounters()]] and [[deleteAll()]] apply to the whole database
-table, while the rest of the methods only apply to the row associated with the ActiveRecord object.
-
-The followings are some examples:
-
-~~~
-// to insert a new customer record
-$customer = new Customer;
-$customer->name = 'James';
-$customer->email = 'james@example.com';
-$customer->save(); // equivalent to $customer->insert();
-
-// to update an existing customer record
-$customer = Customer::find($id);
-$customer->email = 'james@example.com';
-$customer->save(); // equivalent to $customer->update();
-
-// to delete an existing customer record
-$customer = Customer::find($id);
-$customer->delete();
-
-// to increment the age of all customers by 1
-Customer::updateAllCounters(['age' => 1]);
-~~~
-
-
-### Getting Relational Data
-
-Using ActiveRecord you can expose relationships as properties. For example,
-with an appropriate declaration, `$customer->orders` can return an array of `Order` objects
-which represent the orders placed by the specified customer.
-
-To declare a relationship, define a getter method which returns an [[ActiveRelation]] object. For example,
-
-~~~
-class Customer extends \yii\db\ActiveRecord
-{
- public function getOrders()
- {
- return $this->hasMany(Order::className(), ['customer_id' => 'id']);
- }
-}
-
-class Order extends \yii\db\ActiveRecord
-{
- public function getCustomer()
- {
- return $this->hasOne(Customer::className(), ['id' => 'customer_id']);
- }
-}
-~~~
-
-Within the getter methods above, we call [[hasMany()]] or [[hasOne()]] methods to
-create a new [[ActiveRelation]] object. The [[hasMany()]] method declares
-a one-many relationship. For example, a customer has many orders. And the [[hasOne()]]
-method declares a many-one or one-one relationship. For example, an order has one customer.
-Both methods take two parameters:
-
-- `$class`: the name of the class that the related models should use.
-- `$link`: the association between columns from two tables. This should be given as an array.
- The keys of the array are the names of the columns from the table associated with `$class`,
- while the values of the array are the names of the columns from the declaring class.
- It is a good practice to define relationships based on table foreign keys.
-
-After declaring relationships getting relational data is as easy as accessing
-a component property that is defined by the getter method:
-
-~~~
-// the orders of a customer
-$customer = Customer::find($id);
-$orders = $customer->orders; // $orders is an array of Order objects
-
-// the customer of the first order
-$customer2 = $orders[0]->customer; // $customer == $customer2
-~~~
-
-Because [[ActiveRelation]] extends from [[ActiveQuery]], it has the same query building methods,
-which allows us to customize the query for retrieving the related objects.
-For example, we may declare a `bigOrders` relationship which returns orders whose
-subtotal exceeds certain amount:
-
-~~~
-class Customer extends \yii\db\ActiveRecord
-{
- public function getBigOrders($threshold = 100)
- {
- return $this->hasMany(Order::className(), ['customer_id' => 'id'])
- ->where('subtotal > :threshold', [':threshold' => $threshold])
- ->orderBy('id');
- }
-}
-~~~
-
-
-Sometimes, two tables are related together via an intermediary table called
-[pivot table](http://en.wikipedia.org/wiki/Pivot_table). To declare such relationships, we can customize
-the [[ActiveRelation]] object by calling its [[ActiveRelation::via()]] or [[ActiveRelation::viaTable()]]
-method.
-
-For example, if table `tbl_order` and table `tbl_item` are related via pivot table `tbl_order_item`,
-we can declare the `items` relation in the `Order` class like the following:
-
-~~~
-class Order extends \yii\db\ActiveRecord
-{
- public function getItems()
- {
- return $this->hasMany(Item::className(), ['id' => 'item_id'])
- ->viaTable('tbl_order_item', ['order_id' => 'id']);
- }
-}
-~~~
-
-[[ActiveRelation::via()]] method is similar to [[ActiveRelation::viaTable()]] except that
-the first parameter of [[ActiveRelation::via()]] takes a relation name declared in the ActiveRecord class.
-For example, the above `items` relation can be equivalently declared as follows:
-
-~~~
-class Order extends \yii\db\ActiveRecord
-{
- public function getOrderItems()
- {
- return $this->hasMany(OrderItem::className(), ['order_id' => 'id']);
- }
-
- public function getItems()
- {
- return $this->hasMany(Item::className(), ['id' => 'item_id'])
- ->via('orderItems');
- }
-}
-~~~
-
-
-When you access the related objects the first time, behind the scene ActiveRecord performs a DB query
-to retrieve the corresponding data and populate it into the related objects. No query will be performed
-if you access the same related objects again. We call this *lazy loading*. For example,
-
-~~~
-// SQL executed: SELECT * FROM tbl_customer WHERE id=1
-$customer = Customer::find(1);
-// SQL executed: SELECT * FROM tbl_order WHERE customer_id=1
-$orders = $customer->orders;
-// no SQL executed
-$orders2 = $customer->orders;
-~~~
-
-
-Lazy loading is very convenient to use. However, it may suffer from performance
-issue in the following scenario:
-
-~~~
-// SQL executed: SELECT * FROM tbl_customer LIMIT 100
-$customers = Customer::find()->limit(100)->all();
-
-foreach ($customers as $customer) {
- // SQL executed: SELECT * FROM tbl_order WHERE customer_id=...
- $orders = $customer->orders;
- // ...handle $orders...
-}
-~~~
-
-How many SQL queries will be performed in the above code, assuming there are more than 100 customers in
-the database? 101! The first SQL query brings back 100 customers. Then for each customer, a SQL query
-is performed to bring back the customer's orders.
-
-To solve the above performance problem, you can use the so-called *eager loading* by calling [[ActiveQuery::with()]]:
-
-~~~
-// SQL executed: SELECT * FROM tbl_customer LIMIT 100
-// SELECT * FROM tbl_orders WHERE customer_id IN (1,2,...)
-$customers = Customer::find()->limit(100)
- ->with('orders')->all();
-
-foreach ($customers as $customer) {
- // no SQL executed
- $orders = $customer->orders;
- // ...handle $orders...
-}
-~~~
-
-As you can see, only two SQL queries are needed for the same task.
-
-
-Sometimes, you may want to customize the relational queries on the fly. It can be
-done for both lazy loading and eager loading. For example,
-
-~~~
-$customer = Customer::find(1);
-// lazy loading: SELECT * FROM tbl_order WHERE customer_id=1 AND subtotal>100
-$orders = $customer->getOrders()->where('subtotal>100')->all();
-
-// eager loading: SELECT * FROM tbl_customer LIMIT 10
- SELECT * FROM tbl_order WHERE customer_id IN (1,2,...) AND subtotal>100
-$customers = Customer::find()->limit(100)->with([
- 'orders' => function($query) {
- $query->andWhere('subtotal>100');
- },
-])->all();
-~~~
-
-
-### Working with Relationships
-
-ActiveRecord provides the following two methods for establishing and breaking a
-relationship between two ActiveRecord objects:
-
-- [[link()]]
-- [[unlink()]]
-
-For example, given a customer and a new order, we can use the following code to make the
-order owned by the customer:
-
-~~~
-$customer = Customer::find(1);
-$order = new Order;
-$order->subtotal = 100;
-$customer->link('orders', $order);
-~~~
-
-The [[link()]] call above will set the `customer_id` of the order to be the primary key
-value of `$customer` and then call [[save()]] to save the order into database.
-
-
-### Data Input and Validation
-
-TBD
-
-
-### Life Cycles of an ActiveRecord Object
-
-An ActiveRecord object undergoes different life cycles when it is used in different cases.
-Subclasses or ActiveRecord behaviors may "inject" custom code in these life cycles through
-method overriding and event handling mechanisms.
-
-When instantiating a new ActiveRecord instance, we will have the following life cycles:
-
-1. constructor
-2. [[init()]]: will trigger an [[EVENT_INIT]] event
-
-When getting an ActiveRecord instance through the [[find()]] method, we will have the following life cycles:
-
-1. constructor
-2. [[init()]]: will trigger an [[EVENT_INIT]] event
-3. [[afterFind()]]: will trigger an [[EVENT_AFTER_FIND]] event
-
-When calling [[save()]] to insert or update an ActiveRecord, we will have the following life cycles:
-
-1. [[beforeValidate()]]: will trigger an [[EVENT_BEFORE_VALIDATE]] event
-2. [[afterValidate()]]: will trigger an [[EVENT_AFTER_VALIDATE]] event
-3. [[beforeSave()]]: will trigger an [[EVENT_BEFORE_INSERT]] or [[EVENT_BEFORE_UPDATE]] event
-4. perform the actual data insertion or updating
-5. [[afterSave()]]: will trigger an [[EVENT_AFTER_INSERT]] or [[EVENT_AFTER_UPDATE]] event
-
-Finally when calling [[delete()]] to delete an ActiveRecord, we will have the following life cycles:
-
-1. [[beforeDelete()]]: will trigger an [[EVENT_BEFORE_DELETE]] event
-2. perform the actual data deletion
-3. [[afterDelete()]]: will trigger an [[EVENT_AFTER_DELETE]] event
-
-
-### Scopes
-
-A scope is a method that customizes a given [[ActiveQuery]] object. Scope methods are defined
-in the ActiveRecord classes. They can be invoked through the [[ActiveQuery]] object that is created
-via [[find()]] or [[findBySql()]]. The following is an example:
-
-~~~
-class Customer extends \yii\db\ActiveRecord
-{
- // ...
-
- /**
- * @param ActiveQuery $query
- */
- public static function active($query)
- {
- $query->andWhere('status = 1');
- }
-}
-
-$customers = Customer::find()->active()->all();
-~~~
-
-In the above, the `active()` method is defined in `Customer` while we are calling it
-through `ActiveQuery` returned by `Customer::find()`.
-
-Scopes can be parameterized. For example, we can define and use the following `olderThan` scope:
-
-~~~
-class Customer extends \yii\db\ActiveRecord
-{
- // ...
-
- /**
- * @param ActiveQuery $query
- * @param integer $age
- */
- public static function olderThan($query, $age = 30)
- {
- $query->andWhere('age > :age', [':age' => $age]);
- }
-}
-
-$customers = Customer::find()->olderThan(50)->all();
-~~~
-
-The parameters should follow after the `$query` parameter when defining the scope method, and they
-can take default values like shown above.
-
-### Atomic operations and scenarios
-
-TBD
diff --git a/docs/guide/README.md b/docs/guide/README.md
deleted file mode 100644
index 60ee8fb..0000000
--- a/docs/guide/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-This folder contains official Yii 2 guides documentation.
-
-To add new guide, take the following steps:
-
-1. Create `guide-name` and put there relevant documentation;
-2. If guide has more then one word in name, then it should be with dashes, like: `console-fixture.md`, `module-debug.md`;
-3. If your guide is for console commands, than its name should follow convention: `console-{command}.md`;
-4. If your guide is for custom modules, than its name should follow convention: `module-{moduleName}.md`.
diff --git a/docs/guide/active-record.md b/docs/guide/active-record.md
deleted file mode 100644
index 02d5c85..0000000
--- a/docs/guide/active-record.md
+++ /dev/null
@@ -1,769 +0,0 @@
-Active Record
-=============
-
-Active Record implements the [Active Record design pattern](http://en.wikipedia.org/wiki/Active_record).
-The premise behind Active Record is that an individual [[ActiveRecord]] object is associated with a specific row in a database table. The object's attributes are mapped to the columns of the corresponding table. Referencing an Active Record attribute is equivalent to accessing
-the corresponding table column for that record.
-
-As an example, say that the `Customer` ActiveRecord class is associated with the
-`tbl_customer` table. This would mean that the class's `name` attribute is automatically mapped to the `name` column in `tbl_customer`.
-Thanks to Active Record, assuming the variable `$customer` is an object of type `Customer`, to get the value of the `name` column for the table row, you can use the expression `$customer->name`. In this example, Active Record is providing an object-oriented interface for accessing data stored in the database. But Active Record provides much more functionality than this.
-
-With Active Record, instead of writing raw SQL statements to perform database queries, you can call intuitive methods to achieve the same goals. For example, calling [[ActiveRecord::save()|save()]] would perform an INSERT or UPDATE query, creating or updating a row in the associated table of the ActiveRecord class:
-
-```php
-$customer = new Customer();
-$customer->name = 'Qiang';
-$customer->save(); // a new row is inserted into tbl_customer
-```
-
-
-Declaring ActiveRecord Classes
-------------------------------
-
-To declare an ActiveRecord class you need to extend [[\yii\db\ActiveRecord]] and
-implement the `tableName` method:
-
-```php
-use yii\db\ActiveRecord;
-
-class Customer extends ActiveRecord
-{
- /**
- * @return string the name of the table associated with this ActiveRecord class.
- */
- public static function tableName()
- {
- return 'tbl_customer';
- }
-}
-```
-
-The `tableName` method only has to return the name of the database table associated with the class.
-
-Class instances are obtained in one of two ways:
-
-* Using the `new` operator to create a new, empty object
-* Using a method to fetch an existing record (or records) from the database
-
-Connecting to the Database
-----------------------
-
-ActiveRecord relies on a [[Connection|DB connection]] to perform the underlying DB operations.
-By default, ActiveRecord assumes that there is an application component named `db` which provides the needed
-[[Connection]] instance. Usually this component is configured in application configuration file:
-
-```php
-return [
- 'components' => [
- 'db' => [
- 'class' => 'yii\db\Connection',
- 'dsn' => 'mysql:host=localhost;dbname=testdb',
- 'username' => 'demo',
- 'password' => 'demo',
- ],
- ],
-];
-```
-
-Please read the [Database basics](database-basics.md) section to learn more on how to configure and use database connections.
-
-Querying Data from the Database
----------------------------
-
-There are two ActiveRecord methods for querying data from database:
-
- - [[ActiveRecord::find()]]
- - [[ActiveRecord::findBySql()]]
-
-Both methods return an [[ActiveQuery]] instance, which extends [[Query]], and thus supports
-the same set of flexible and powerful DB query methods. The following examples demonstrate some of the possibilities.
-
-```php
-// to retrieve all *active* customers and order them by their ID:
-$customers = Customer::find()
- ->where(['status' => $active])
- ->orderBy('id')
- ->all();
-
-// to return a single customer whose ID is 1:
-$customer = Customer::find(1);
-
-// the above code is equivalent to the following:
-$customer = Customer::find()
- ->where(['id' => 1])
- ->one();
-
-// to retrieve customers using a raw SQL statement:
-$sql = 'SELECT * FROM tbl_customer';
-$customers = Customer::findBySql($sql)->all();
-
-// to return the number of *active* customers:
-$count = Customer::find()
- ->where(['status' => $active])
- ->count();
-
-// to return customers in terms of arrays rather than `Customer` objects:
-$customers = Customer::find()
- ->asArray()
- ->all();
-// each element of $customers is an array of name-value pairs
-
-// to index the result by customer IDs:
-$customers = Customer::find()->indexBy('id')->all();
-// $customers array is indexed by customer IDs
-```
-
-
-Accessing Column Data
----------------------
-
-ActiveRecord maps each column of the corresponding database table row to an attribute in the ActiveRecord
-object. The attribute behaves like any regular object public property. The attribute's name will be the same as the corresponding column
-name, and is case-sensitive.
-
-To read the value of a column, you can use the following syntax:
-
-```php
-// "id" and "email" are the names of columns in the table associated with $customer ActiveRecord object
-$id = $customer->id;
-$email = $customer->email;
-```
-
-To change the value of a column, assign a new value to the associated property and save the object:
-
-```
-$customer->email = 'jane@example.com';
-$customer->save();
-```
-
-Manipulating Data in the Database
------------------------------
-
-ActiveRecord provides the following methods to insert, update and delete data in the database:
-
-- [[ActiveRecord::save()|save()]]
-- [[ActiveRecord::insert()|insert()]]
-- [[ActiveRecord::update()|update()]]
-- [[ActiveRecord::delete()|delete()]]
-- [[ActiveRecord::updateCounters()|updateCounters()]]
-- [[ActiveRecord::updateAll()|updateAll()]]
-- [[ActiveRecord::updateAllCounters()|updateAllCounters()]]
-- [[ActiveRecord::deleteAll()|deleteAll()]]
-
-Note that [[ActiveRecord::updateAll()|updateAll()]], [[ActiveRecord::updateAllCounters()|updateAllCounters()]]
-and [[ActiveRecord::deleteAll()|deleteAll()]] are static methods that apply to the whole database
-table. The other methods only apply to the row associated with the ActiveRecord object through which the method is being called.
-
-```php
-// to insert a new customer record
-$customer = new Customer;
-$customer->name = 'James';
-$customer->email = 'james@example.com';
-$customer->save(); // equivalent to $customer->insert();
-
-// to update an existing customer record
-$customer = Customer::find($id);
-$customer->email = 'james@example.com';
-$customer->save(); // equivalent to $customer->update();
-
-// to delete an existing customer record
-$customer = Customer::find($id);
-$customer->delete();
-
-// to increment the age of ALL customers by 1
-Customer::updateAllCounters(['age' => 1]);
-```
-
-> Info: The `save()` method will either perform an `INSERT` or `UPDATE` SQL statement, depending
- on whether the ActiveRecord being saved is new or not by checking `ActiveRecord::isNewRecord`.
-
-
-Data Input and Validation
--------------------------
-
-ActiveRecord inherits data validation and data input features from [[\yii\base\Model]]. Data validation is called
-automatically when `save()` is performed. If data validation fails, the saving operation will be cancelled.
-
-For more details refer to the [Model](model.md) section of this guide.
-
-Querying Relational Data
-------------------------
-
-You can use ActiveRecord to also query a table's relational data (i.e., selection of data from Table A can also pull in related data from Table B). Thanks to ActiveRecord, the relational data returned can be accessed like a property of the ActiveRecord object associated with the primary table.
-
-For example, with an appropriate relation declaration, by accessing `$customer->orders` you may obtain
-an array of `Order` objects which represent the orders placed by the specified customer.
-
-To declare a relation, define a getter method which returns an [[ActiveRelation]] object. For example,
-
-```php
-class Customer extends \yii\db\ActiveRecord
-{
- public function getOrders()
- {
- return $this->hasMany(Order::className(), ['customer_id' => 'id']);
- }
-}
-
-class Order extends \yii\db\ActiveRecord
-{
- public function getCustomer()
- {
- return $this->hasOne(Customer::className(), ['id' => 'customer_id']);
- }
-}
-```
-
-The methods [[ActiveRecord::hasMany()]] and [[ActiveRecord::hasOne()]] used in the above
-are used to model the many-one relationship and one-one relationship in a relational database.
-For example, a customer has many orders, and an order has one customer.
-Both methods take two parameters and return an [[ActiveRelation]] object:
-
- - `$class`: the name of the class of the related model(s). This should be a fully qualified class name.
- - `$link`: the association between columns from the two tables. This should be given as an array.
- The keys of the array are the names of the columns from the table associated with `$class`,
- while the values of the array are the names of the columns from the declaring class.
- It is a good practice to define relationships based on table foreign keys.
-
-After declaring relations, getting relational data is as easy as accessing a component property
-that is defined by the corresponding getter method:
-
-```php
-// get the orders of a customer
-$customer = Customer::find(1);
-$orders = $customer->orders; // $orders is an array of Order objects
-```
-
-Behind the scene, the above code executes the following two SQL queries, one for each line of code:
-
-```sql
-SELECT * FROM tbl_customer WHERE id=1;
-SELECT * FROM tbl_order WHERE customer_id=1;
-```
-
-> Tip: If you access the expression `$customer->orders` again, will it perform the second SQL query again?
-Nope. The SQL query is only performed the first time when this expression is accessed. Any further
-accesses will only return the previously fetched results that are cached internally. If you want to re-query
-the relational data, simply unset the existing one first: `unset($customer->orders);`.
-
-Sometimes, you may want to pass parameters to a relational query. For example, instead of returning
-all orders of a customer, you may want to return only big orders whose subtotal exceeds a specified amount.
-To do so, declare a `bigOrders` relation with the following getter method:
-
-```php
-class Customer extends \yii\db\ActiveRecord
-{
- public function getBigOrders($threshold = 100)
- {
- return $this->hasMany(Order::className(), ['customer_id' => 'id'])
- ->where('subtotal > :threshold', [':threshold' => $threshold])
- ->orderBy('id');
- }
-}
-```
-
-Remember that `hasMany()` returns an [[ActiveRelation]] object which extends from [[ActiveQuery]]
-and thus supports the same set of querying methods as [[ActiveQuery]].
-
-With the above declaration, if you access `$customer->bigOrders`, it will only return the orders
-whose subtotal is greater than 100. To specify a different threshold value, use the following code:
-
-```php
-$orders = $customer->getBigOrders(200)->all();
-```
-
-
-Relations with Pivot Table
---------------------------
-
-Sometimes, two tables are related together via an intermediary table called
-[pivot table](http://en.wikipedia.org/wiki/Pivot_table). To declare such relations, we can customize
-the [[ActiveRelation]] object by calling its [[ActiveRelation::via()]] or [[ActiveRelation::viaTable()]]
-method.
-
-For example, if table `tbl_order` and table `tbl_item` are related via pivot table `tbl_order_item`,
-we can declare the `items` relation in the `Order` class like the following:
-
-```php
-class Order extends \yii\db\ActiveRecord
-{
- public function getItems()
- {
- return $this->hasMany(Item::className(), ['id' => 'item_id'])
- ->viaTable('tbl_order_item', ['order_id' => 'id']);
- }
-}
-```
-
-[[ActiveRelation::via()]] method is similar to [[ActiveRelation::viaTable()]] except that
-the first parameter of [[ActiveRelation::via()]] takes a relation name declared in the ActiveRecord class
-instead of the pivot table name. For example, the above `items` relation can be equivalently declared as follows:
-
-```php
-class Order extends \yii\db\ActiveRecord
-{
- public function getOrderItems()
- {
- return $this->hasMany(OrderItem::className(), ['order_id' => 'id']);
- }
-
- public function getItems()
- {
- return $this->hasMany(Item::className(), ['id' => 'item_id'])
- ->via('orderItems');
- }
-}
-```
-
-
-Lazy and Eager Loading
-----------------------
-
-As described earlier, when you access the related objects the first time, ActiveRecord will perform a DB query
-to retrieve the corresponding data and populate it into the related objects. No query will be performed
-if you access the same related objects again. We call this *lazy loading*. For example,
-
-```php
-// SQL executed: SELECT * FROM tbl_customer WHERE id=1
-$customer = Customer::find(1);
-// SQL executed: SELECT * FROM tbl_order WHERE customer_id=1
-$orders = $customer->orders;
-// no SQL executed
-$orders2 = $customer->orders;
-```
-
-Lazy loading is very convenient to use. However, it may suffer from a performance issue in the following scenario:
-
-```php
-// SQL executed: SELECT * FROM tbl_customer LIMIT 100
-$customers = Customer::find()->limit(100)->all();
-
-foreach ($customers as $customer) {
- // SQL executed: SELECT * FROM tbl_order WHERE customer_id=...
- $orders = $customer->orders;
- // ...handle $orders...
-}
-```
-
-How many SQL queries will be performed in the above code, assuming there are more than 100 customers in
-the database? 101! The first SQL query brings back 100 customers. Then for each customer, a SQL query
-is performed to bring back the orders of that customer.
-
-To solve the above performance problem, you can use the so-called *eager loading* approach by calling [[ActiveQuery::with()]]:
-
-```php
-// SQL executed: SELECT * FROM tbl_customer LIMIT 100;
-// SELECT * FROM tbl_orders WHERE customer_id IN (1,2,...)
-$customers = Customer::find()->limit(100)
- ->with('orders')->all();
-
-foreach ($customers as $customer) {
- // no SQL executed
- $orders = $customer->orders;
- // ...handle $orders...
-}
-```
-
-As you can see, only two SQL queries are needed for the same task.
-
-
-Sometimes, you may want to customize the relational queries on the fly. This can be
-done for both lazy loading and eager loading. For example,
-
-```php
-$customer = Customer::find(1);
-// lazy loading: SELECT * FROM tbl_order WHERE customer_id=1 AND subtotal>100
-$orders = $customer->getOrders()->where('subtotal>100')->all();
-
-// eager loading: SELECT * FROM tbl_customer LIMIT 100
-// SELECT * FROM tbl_order WHERE customer_id IN (1,2,...) AND subtotal>100
-$customers = Customer::find()->limit(100)->with([
- 'orders' => function($query) {
- $query->andWhere('subtotal>100');
- },
-])->all();
-```
-
-
-Joining with Relations
-----------------------
-
-When working with relational databases, a common task is to join multiple tables and apply various
-query conditions and parameters to the JOIN SQL statement. Instead of calling [[ActiveQuery::join()]]
-explicitly to build up the JOIN query, you may reuse the existing relation definitions and call
-[[ActiveQuery::joinWith()]] to achieve this goal. For example,
-
-```php
-// find all orders and sort the orders by the customer id and the order id. also eager loading "customer"
-$orders = Order::find()->joinWith('customer')->orderBy('tbl_customer.id, tbl_order.id')->all();
-// find all orders that contain books, and eager loading "books"
-$orders = Order::find()->innerJoinWith('books')->all();
-```
-
-In the above, the method [[ActiveQuery::innerJoinWith()|innerJoinWith()]] is a shortcut to [[ActiveQuery::joinWith()|joinWith()]]
-with the join type set as `INNER JOIN`.
-
-You may join with one or multiple relations; you may apply query conditions to the relations on-the-fly;
-and you may also join with sub-relations. For example,
-
-```php
-// join with multiple relations
-// find out the orders that contain books and are placed by customers who registered within the past 24 hours
-$orders = Order::find()->innerJoinWith([
- 'books',
- 'customer' => function ($query) {
- $query->where('tbl_customer.create_time > ' . (time() - 24 * 3600));
- }
-])->all();
-// join with sub-relations: join with books and books' authors
-$orders = Order::find()->joinWith('books.author')->all();
-```
-
-Behind the scene, Yii will first execute a JOIN SQL statement to bring back the primary models
-satisfying the conditions applied to the JOIN SQL. It will then execute a query for each relation
-and populate the corresponding related records.
-
-The difference between [[ActiveQuery::joinWith()|joinWith()]] and [[ActiveQuery::with()|with()]] is that
-the former joins the tables for the primary model class and the related model classes to retrieve
-the primary models, while the latter just queries against the table for the primary model class to
-retrieve the primary models.
-
-Because of this difference, you may apply query conditions that are only available to a JOIN SQL statement.
-For example, you may filter the primary models by the conditions on the related models, like the example
-above. You may also sort the primary models using columns from the related tables.
-
-When using [[ActiveQuery::joinWith()|joinWith()]], you are responsible to disambiguate column names.
-In the above examples, we use `tbl_item.id` and `tbl_order.id` to disambiguate the `id` column references
-because both of the order table and the item table contain a column named `id`.
-
-By default, when you join with a relation, the relation will also be eagerly loaded. You may change this behavior
-by passing the `$eagerLoading` parameter which specifies whether to eager load the specified relations.
-
-And also by default, [[ActiveQuery::joinWith()|joinWith()]] uses `LEFT JOIN` to join the related tables.
-You may pass it with the `$joinType` parameter to customize the join type. As a shortcut to the `INNER JOIN` type,
-you may use [[ActiveQuery::innerJoinWith()|innerJoinWith()]].
-
-Below are some more examples,
-
-```php
-// find all orders that contain books, but do not eager loading "books".
-$orders = Order::find()->innerJoinWith('books', false)->all();
-// which is equivalent to the above
-$orders = Order::find()->joinWith('books', false, 'INNER JOIN')->all();
-```
-
-Sometimes when joining two tables, you may need to specify some extra condition in the ON part of the JOIN query.
-This can be done by calling the [[\yii\db\ActiveRelation::onCondition()]] method like the following:
-
-```php
-class User extends ActiveRecord
-{
- public function getBooks()
- {
- return $this->hasMany(Item::className(), ['owner_id' => 'id'])->onCondition(['category_id' => 1]);
- }
-}
-```
-
-In the above, the `hasMany()` method returns an `ActiveRelation` instance, upon which `onCondition()` is called
-to specify that only items whose `category_id` is 1 should be returned.
-
-When you perform query using [[ActiveQuery::joinWith()|joinWith()]], the on-condition will be put in the ON part
-of the corresponding JOIN query. For example,
-
-```php
-// SELECT tbl_user.* FROM tbl_user LEFT JOIN tbl_item ON tbl_item.owner_id=tbl_user.id AND category_id=1
-// SELECT * FROM tbl_item WHERE owner_id IN (...) AND category_id=1
-$users = User::model()->joinWith('books')->all();
-```
-
-Note that if you use eager loading via [[ActiveQuery::with()]] or lazy loading, the on-condition will be put
-in the WHERE part of the corresponding SQL statement, because there is no JOIN query involved. For example,
-
-```php
-// SELECT * FROM tbl_user WHERE id=10
-$user = User::model(10);
-// SELECT * FROM tbl_item WHERE owner_id=10 AND category_id=1
-$books = $user->books;
-```
-
-
-Working with Relationships
---------------------------
-
-ActiveRecord provides the following two methods for establishing and breaking a
-relationship between two ActiveRecord objects:
-
-- [[ActiveRecord::link()|link()]]
-- [[ActiveRecord::unlink()|unlink()]]
-
-For example, given a customer and a new order, we can use the following code to make the
-order owned by the customer:
-
-```php
-$customer = Customer::find(1);
-$order = new Order;
-$order->subtotal = 100;
-$customer->link('orders', $order);
-```
-
-The [[link()]] call above will set the `customer_id` of the order to be the primary key
-value of `$customer` and then call [[save()]] to save the order into database.
-
-
-Life Cycles of an ActiveRecord Object
--------------------------------------
-
-An ActiveRecord object undergoes different life cycles when it is used in different cases.
-Subclasses or ActiveRecord behaviors may "inject" custom code in these life cycles through
-method overriding and event handling mechanisms.
-
-When instantiating a new ActiveRecord instance, we will have the following life cycles:
-
-1. constructor
-2. [[init()]]: will trigger an [[EVENT_INIT]] event
-
-When getting an ActiveRecord instance through the [[find()]] method, we will have the following life cycles:
-
-1. constructor
-2. [[init()]]: will trigger an [[EVENT_INIT]] event
-3. [[afterFind()]]: will trigger an [[EVENT_AFTER_FIND]] event
-
-When calling [[save()]] to insert or update an ActiveRecord, we will have the following life cycles:
-
-1. [[beforeValidate()]]: will trigger an [[EVENT_BEFORE_VALIDATE]] event
-2. [[afterValidate()]]: will trigger an [[EVENT_AFTER_VALIDATE]] event
-3. [[beforeSave()]]: will trigger an [[EVENT_BEFORE_INSERT]] or [[EVENT_BEFORE_UPDATE]] event
-4. perform the actual data insertion or updating
-5. [[afterSave()]]: will trigger an [[EVENT_AFTER_INSERT]] or [[EVENT_AFTER_UPDATE]] event
-
-Finally when calling [[delete()]] to delete an ActiveRecord, we will have the following life cycles:
-
-1. [[beforeDelete()]]: will trigger an [[EVENT_BEFORE_DELETE]] event
-2. perform the actual data deletion
-3. [[afterDelete()]]: will trigger an [[EVENT_AFTER_DELETE]] event
-
-
-Scopes
-------
-
-A scope is a method that customizes a given [[ActiveQuery]] object. Scope methods are static and are defined
-in the ActiveRecord classes. They can be invoked through the [[ActiveQuery]] object that is created
-via [[find()]] or [[findBySql()]]. The following is an example:
-
-```php
-class Comment extends \yii\db\ActiveRecord
-{
- // ...
-
- /**
- * @param ActiveQuery $query
- */
- public static function active($query)
- {
- $query->andWhere('status = 1');
- }
-}
-
-$comments = Comment::find()->active()->all();
-```
-
-In the above, the `active()` method is defined in `Comment` while we are calling it
-through `ActiveQuery` returned by `Comment::find()`.
-
-You can also use scopes when defining relations. For example,
-
-```php
-class Post extends \yii\db\ActiveRecord
-{
- public function getComments()
- {
- return $this->hasMany(Comment::className(), ['post_id' => 'id'])->active();
-
- }
-}
-```
-
-Or use the scopes on-the-fly when performing relational query:
-
-```php
-$posts = Post::find()->with([
- 'comments' => function($q) {
- $q->active();
- }
-])->all();
-```
-
-Scopes can be parameterized. For example, we can define and use the following `olderThan` scope:
-
-```php
-class Customer extends \yii\db\ActiveRecord
-{
- // ...
-
- /**
- * @param ActiveQuery $query
- * @param integer $age
- */
- public static function olderThan($query, $age = 30)
- {
- $query->andWhere('age > :age', [':age' => $age]);
- }
-}
-
-$customers = Customer::find()->olderThan(50)->all();
-```
-
-The parameters should follow after the `$query` parameter when defining the scope method, and they
-can take default values like shown above.
-
-
-Transactional operations
-------------------------
-
-
-When a few DB operations are related and are executed
-
-TODO: FIXME: WIP, TBD, https://github.com/yiisoft/yii2/issues/226
-
-,
-[[afterSave()]], [[beforeDelete()]] and/or [[afterDelete()]] life cycle methods. Developer may come
-to the solution of overriding ActiveRecord [[save()]] method with database transaction wrapping or
-even using transaction in controller action, which is strictly speaking doesn't seems to be a good
-practice (recall skinny-controller fat-model fundamental rule).
-
-Here these ways are (**DO NOT** use them unless you're sure what are you actually doing). Models:
-
-```php
-class Feature extends \yii\db\ActiveRecord
-{
- // ...
-
- public function getProduct()
- {
- return $this->hasOne(Product::className(), ['product_id' => 'id']);
- }
-}
-
-class Product extends \yii\db\ActiveRecord
-{
- // ...
-
- public function getFeatures()
- {
- return $this->hasMany(Feature::className(), ['id' => 'product_id']);
- }
-}
-```
-
-Overriding [[save()]] method:
-
-```php
-
-class ProductController extends \yii\web\Controller
-{
- public function actionCreate()
- {
- // FIXME: TODO: WIP, TBD
- }
-}
-```
-
-Using transactions within controller layer:
-
-```php
-class ProductController extends \yii\web\Controller
-{
- public function actionCreate()
- {
- // FIXME: TODO: WIP, TBD
- }
-}
-```
-
-Instead of using these fragile methods you should consider using atomic scenarios and operations feature.
-
-```php
-class Feature extends \yii\db\ActiveRecord
-{
- // ...
-
- public function getProduct()
- {
- return $this->hasOne(Product::className(), ['product_id' => 'id']);
- }
-
- public function scenarios()
- {
- return [
- 'userCreates' => [
- 'attributes' => ['name', 'value'],
- 'atomic' => [self::OP_INSERT],
- ],
- ];
- }
-}
-
-class Product extends \yii\db\ActiveRecord
-{
- // ...
-
- public function getFeatures()
- {
- return $this->hasMany(Feature::className(), ['id' => 'product_id']);
- }
-
- public function scenarios()
- {
- return [
- 'userCreates' => [
- 'attributes' => ['title', 'price'],
- 'atomic' => [self::OP_INSERT],
- ],
- ];
- }
-
- public function afterValidate()
- {
- parent::afterValidate();
- // FIXME: TODO: WIP, TBD
- }
-
- public function afterSave($insert)
- {
- parent::afterSave($insert);
- if ($this->getScenario() === 'userCreates') {
- // FIXME: TODO: WIP, TBD
- }
- }
-}
-```
-
-Controller is very thin and neat:
-
-```php
-class ProductController extends \yii\web\Controller
-{
- public function actionCreate()
- {
- // FIXME: TODO: WIP, TBD
- }
-}
-```
-
-Optimistic Locks
-----------------
-
-TODO
-
-Dirty Attributes
-----------------
-
-TODO
-
-See also
---------
-
-- [Model](model.md)
-- [[\yii\db\ActiveRecord]]
diff --git a/docs/guide/apps-advanced.md b/docs/guide/apps-advanced.md
deleted file mode 100644
index bf1d323..0000000
--- a/docs/guide/apps-advanced.md
+++ /dev/null
@@ -1,174 +0,0 @@
-Advanced application template
-=============================
-
-This template is for large projects developed in teams where backend is divided from frontend, application is deployed
-to multiple servers etc. This application template also goes a bit further regarding features and provides essential
-database, signup and password restore out of the box.
-
-Installation
-------------
-
-### Install via Composer
-
-If you do not have [Composer](http://getcomposer.org/), you may download it from
-[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS:
-
-~~~
-curl -s http://getcomposer.org/installer | php
-~~~
-
-You can then install the application using the following command:
-
-~~~
-php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced /path/to/yii-application
-~~~
-
-Getting started
----------------
-
-After you install the application, you have to conduct the following steps to initialize
-the installed application. You only need to do these once for all.
-
-1. Execute the `init` command and select `dev` as environment.
----
-php /path/to/yii-application/init
----
-2. Create a new database and adjust the `components.db` configuration in `common/config/params-local.php` accordingly.
-3. Apply migrations with console command `yii migrate`.
-4. Set document roots of your Web server:
-
-- for frontend `/path/to/yii-application/frontend/web/` and using the URL `http://frontend/`
-- for backend `/path/to/yii-application/backend/web/` and using the URL `http://backend/`
-
-Directory structure
--------------------
-
-The root directory contains the following subdirectories:
-
-- `backend` - backend web application.
-- `common` - files common to all applications.
-- `console` - console application.
-- `environments` - environment configs.
-- `frontend` - frontend web application.
-
-Root directory contains a set of files.
-
-- `.gitignore` contains a list of directories ignored by git version system. If you need something never get to your source
- code repository, add it there.
-- `composer.json` - Composer config described in detail below.
-- `init` - initialization script described in "Composer config described in detail below".
-- `init.bat` - same for Windows.
-- `LICENSE.md` - license info. Put your project license there. Especially when opensourcing.
-- `README.md` - basic info about installing template. Consider replacing it with information about your project and its
- installation.
-- `requirements.php` - Yii requirements checker.
-- `yii` - console application bootstrap.
-- `yii.bat` - same for Windows.
-
-Applications
-------------
-
-There are three applications in advanced template: frontend, backend and console. Frontend is typically what is presented
-to end user, the project itself. Backend is admin panel, analytics and such functionality. Console is typically used for
-cron jobs and low-level server management. Also it's used during application deployment and handles migrations and assets.
-
-There's also a `common` directory that contains files used by more than one application. For example, `User` model.
-
-frontend and backend are both web applications and both contain `web` directory. That's the webroot you should point your
-webserver to.
-
-Each application has its own namespace and alias corresponding to its name. Same applies to common directory.
-
-Configuration and environments
-------------------------------
-
-There are multiple problems with straightforward approach to configuration:
-
-- Each team member has its own configuration options. Committing such config will affect other team members.
-- Production database password and API keys should not end up in repository.
-- There are multiple servers: development, testing, production. Each should have its own configuration.
-- Defining all configuration options for each case is very repetitive and takes too much time to maintain.
-
-In order to solve these issues Yii introduces environments concept that is very simple. Each environment is represented
-by a set of files under `environments` directory. `init` command is used to switch between these. What is really does is
-just copying everything from environment directory over the root directory where all applications are.
-
-Typically environment contains application bootstrap files such as `index.php` and config files suffixed with
-`-local.php`. These are added to `.gitignore` and never added to source code repository.
-
-In order to avoid duplication configurations are overriding each other. For example, frontend reads configuration in the
-following order:
-
-- `frontend/config/main.php`
-- `frontend/config/main-local.php`
-
-Parameters are read in the following order:
-
-- `common/config/params.php`
-- `common/config/params-local.php`
-- `frontend/config/params.php`
-- `frontend/config/params-local.php`
-
-The later config file overrides the former.
-
-Another difference is that most application component configurations are moved to params. Since params are read from
-`common` as well it allows you to specify database connection in one file and it will be then used for all applications.
-
-Configuring Composer
---------------------
-
-After application template is installed it's a good idea to adjust default `composer.json` that can be found in the root
-directory:
-
-```json
-{
- "name": "yiisoft/yii2-app-advanced",
- "description": "Yii 2 Advanced Application Template",
- "keywords": ["yii", "framework", "advanced", "application template"],
- "homepage": "http://www.yiiframework.com/",
- "type": "project",
- "license": "BSD-3-Clause",
- "support": {
- "issues": "https://github.com/yiisoft/yii2/issues?state=open",
- "forum": "http://www.yiiframework.com/forum/",
- "wiki": "http://www.yiiframework.com/wiki/",
- "irc": "irc://irc.freenode.net/yii",
- "source": "https://github.com/yiisoft/yii2"
- },
- "minimum-stability": "dev",
- "require": {
- "php": ">=5.4.0",
- "yiisoft/yii2": "*",
- "yiisoft/yii2-swiftmailer": "*",
- "yiisoft/yii2-bootstrap": "*",
- "yiisoft/yii2-debug": "*",
- "yiisoft/yii2-gii": "*"
- },
- "scripts": {
- "post-create-project-cmd": [
- "yii\\composer\\Installer::setPermission"
- ]
- },
- "extra": {
- "writable": [
- "backend/runtime",
- "backend/web/assets",
-
- "console/runtime",
- "console/migrations",
-
- "frontend/runtime",
- "frontend/web/assets"
- ]
- }
-}
-```
-
-First we're updating basic information. Change `name`, `description`, `keywords`, `homepage` and `support` to match
-your project.
-
-Now the interesting part. You can add more packages your application needs to `require` section.
-All these packages are coming from [packagist.org](https://packagist.org/) so feel free to browse the website for useful code.
-
-After your `composer.json` is changed you can run `php composer.phar update --prefer-dist`, wait till packages are downloaded and
-installed and then just use them. Autoloading of classes will be handled automatically.
diff --git a/docs/guide/apps-basic.md b/docs/guide/apps-basic.md
deleted file mode 100644
index 873125c..0000000
--- a/docs/guide/apps-basic.md
+++ /dev/null
@@ -1,163 +0,0 @@
-Basic application template
-==========================
-
-This template is a perfect fit for small projects or learning Yii2.
-
-The application has four pages: the homepage, the about page, the contact page and the login page.
-The contact page displays a contact form that users can fill in to submit their inquiries to the webmaster,
-and the login page allows users to be authenticated before accessing privileged contents.
-
-Installation
-------------
-
-If you do not have [Composer](http://getcomposer.org/), you may download it from
-[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS:
-
-~~~
-curl -s http://getcomposer.org/installer | php
-~~~
-
-You can then install the Bootstrap Application using the following command:
-
-~~~
-php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic /path/to/yii-application
-~~~
-
-Now set document root directory of your Web server to /path/to/yii-application/web and you should be able to access the application using the URL `http://localhost/`.
-
-Directory structure
--------------------
-
-The basic application does not divide application directories much. Here's the basic structure:
-
-- `assets` - application asset files.
- - `AppAsset.php` - definition of application assets such as CSS, JavaScript etc. Check [Managing assets](assets.md) for
- details.
-- `commands` - console controllers.
-- `config` - configuration.
-- `controllers` - web controllers.
-- `models` - application models.
-- `runtime` - logs, states, file cache.
-- `views` - view templates.
-- `web` - webroot.
-
-Root directory contains a set of files.
-
-- `.gitignore` contains a list of directories ignored by git version system. If you need something never get to your source
-code repository, add it there.
-- `codeception.yml` - Codeception config.
-- `composer.json` - Composer config described in detail below.
-- `LICENSE.md` - license info. Put your project license there. Especially when opensourcing.
-- `README.md` - basic info about installing template. Consider replacing it with information about your project and its
- installation.
-- `requirements.php` - Yii requirements checker.
-- `yii` - console application bootstrap.
-- `yii.bat` - same for Windows.
-
-
-### config
-
-This directory contains configuration files:
-
-- `console.php` - console application configuration.
-- `params.php` - common application parameters.
-- `web.php` - web application configuration.
-- `web-test.php` - web application configuration used when running functional tests.
-
-All these files are returning arrays used to configure corresponding application properties. Check
-[Configuration](configuration.md) guide section for details.
-
-### views
-
-Views directory contains templates your application is using. In the basic template there are:
-
-```
-layouts
- main.php
-site
- about.php
- contact.php
- error.php
- index.php
- login.php
-```
-
-`layouts` contains HTML layouts i.e. page markup except content: doctype, head section, main menu, footer etc.
-The rest are typically controller views. By convention these are located in subdirectories matching controller id. For
-`SiteController` views are under `site`. Names of the views themselves are typically match controller action names.
-Partials are often named starting with underscore.
-
-### web
-
-Directory is a webroot. Typically a webserver is pointed into it.
-
-```
-assets
-css
-index.php
-index-test.php
-```
-
-`assets` contains published asset files such as CSS, JavaScript etc. Publishing process is automatic so you don't need
-to do anything with this directory other than making sure Yii has enough permissions to write to it.
-
-`css` contains plain CSS files and is useful for global CSS that isn't going to be compressed or merged by assets manager.
-
-`index.php` is the main web application bootstrap and is the central entry point for it. `index-test.php` is the entry
-point for functional testing.
-
-Configuring Composer
---------------------
-
-After application template is installed it's a good idea to adjust default `composer.json` that can be found in the root
-directory:
-
-```json
-{
- "name": "yiisoft/yii2-app-basic",
- "description": "Yii 2 Basic Application Template",
- "keywords": ["yii", "framework", "basic", "application template"],
- "homepage": "http://www.yiiframework.com/",
- "type": "project",
- "license": "BSD-3-Clause",
- "support": {
- "issues": "https://github.com/yiisoft/yii2/issues?state=open",
- "forum": "http://www.yiiframework.com/forum/",
- "wiki": "http://www.yiiframework.com/wiki/",
- "irc": "irc://irc.freenode.net/yii",
- "source": "https://github.com/yiisoft/yii2"
- },
- "minimum-stability": "dev",
- "require": {
- "php": ">=5.4.0",
- "yiisoft/yii2": "*",
- "yiisoft/yii2-swiftmailer": "*",
- "yiisoft/yii2-bootstrap": "*",
- "yiisoft/yii2-debug": "*",
- "yiisoft/yii2-gii": "*"
- },
- "scripts": {
- "post-create-project-cmd": [
- "yii\\composer\\Installer::setPermission"
- ]
- },
- "extra": {
- "writable": [
- "runtime",
- "web/assets"
- ],
- "executable": [
- "yii"
- ]
- }
-}
-```
-
-First we're updating basic information. Change `name`, `description`, `keywords`, `homepage` and `support` to match
-your project.
-
-Now the interesting part. You can add more packages your application needs to `require` section.
-All these packages are coming from [packagist.org](https://packagist.org/) so feel free to browse the website for useful code.
-
-After your `composer.json` is changed you can run `php composer.phar update --prefer-dist`, wait till packages are downloaded and
-installed and then just use them. Autoloading of classes will be handled automatically.
diff --git a/docs/guide/apps-own.md b/docs/guide/apps-own.md
deleted file mode 100644
index 3ebf83f..0000000
--- a/docs/guide/apps-own.md
+++ /dev/null
@@ -1,4 +0,0 @@
-Creating your own Application structure
-=======================================
-
-TBD
\ No newline at end of file
diff --git a/docs/guide/assets.md b/docs/guide/assets.md
deleted file mode 100644
index 467d7f8..0000000
--- a/docs/guide/assets.md
+++ /dev/null
@@ -1,270 +0,0 @@
-Managing assets
-===============
-
-An asset in Yii is a file that is included into the page. It could be CSS, JavaScript or
-any other file. Framework provides many ways to work with assets from basics such as adding `
-
-
-endBody(); ?>
-