Merge branch 'master' of github.com:yiisoft/yii2
* 'master' of github.com:yiisoft/yii2: typo fixed extension list file location. doc fix. moved extension list under yiisoft. updated read me. updated license information. reorganized extension directories. Adjusted jui directories. moved mutex back from extensions. Changed the exit status to normal. Specify the exact type of the exception. Small typos PhpDoc comment Missing return statement Changed php-diff dependency to use code from master (they haven't tagged changes we need yet) Added ability to get all GET, POST, PUT, DELETE or PATCH parameters to Request Add batchInsert method to yii\db\Migration Fixes #1117: added support to map a single view directory to multiple themed view directories. Fixes #1116.
@@ -1,7 +1,7 @@
|
||||
The Yii framework is free software. It is released under the terms of
|
||||
the following BSD License.
|
||||
|
||||
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com)
|
||||
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -29,4 +29,4 @@ 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.
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
The Yii framework is free software. It is released under the terms of
|
||||
the following BSD License.
|
||||
|
||||
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com)
|
||||
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -29,4 +29,4 @@ 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.
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -15,7 +15,7 @@ return [
|
||||
'preload' => ['log'],
|
||||
'controllerNamespace' => 'backend\controllers',
|
||||
'modules' => [],
|
||||
'extensions' => require(__DIR__ . '/../../vendor/yii-extensions.php'),
|
||||
'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
|
||||
'components' => [
|
||||
'request' => [
|
||||
'enableCsrfValidation' => true,
|
||||
|
||||
@@ -15,7 +15,7 @@ return [
|
||||
'controllerNamespace' => 'console\controllers',
|
||||
'modules' => [
|
||||
],
|
||||
'extensions' => require(__DIR__ . '/../../vendor/yii-extensions.php'),
|
||||
'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
|
||||
'components' => [
|
||||
'db' => $params['components.db'],
|
||||
'cache' => $params['components.cache'],
|
||||
|
||||
@@ -16,7 +16,7 @@ return [
|
||||
'modules' => [
|
||||
'gii' => 'yii\gii\Module'
|
||||
],
|
||||
'extensions' => require(__DIR__ . '/../../vendor/yii-extensions.php'),
|
||||
'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
|
||||
'components' => [
|
||||
'request' => [
|
||||
'enableCsrfValidation' => true,
|
||||
|
||||
@@ -18,7 +18,7 @@ if (empty($params['env'])) {
|
||||
|
||||
if (!ctype_digit($answer) || !in_array($answer, range(0, count($envs) - 1))) {
|
||||
echo "\n Quit initialization.\n";
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (isset($envNames[$answer])) {
|
||||
@@ -42,7 +42,7 @@ if (empty($params['env'])) {
|
||||
$answer = trim(fgets(STDIN));
|
||||
if (strncasecmp($answer, 'y', 1)) {
|
||||
echo "\n Quit initialization.\n";
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
The Yii framework is free software. It is released under the terms of
|
||||
the following BSD License.
|
||||
|
||||
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com)
|
||||
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -29,4 +29,4 @@ 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.
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -6,7 +6,7 @@ return [
|
||||
'preload' => ['log'],
|
||||
'controllerPath' => dirname(__DIR__) . '/commands',
|
||||
'controllerNamespace' => 'app\commands',
|
||||
'extensions' => require(__DIR__ . '/../vendor/yii-extensions.php'),
|
||||
'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
|
||||
'components' => [
|
||||
'cache' => [
|
||||
'class' => 'yii\caching\FileCache',
|
||||
|
||||
@@ -3,7 +3,7 @@ $params = require(__DIR__ . '/params.php');
|
||||
$config = [
|
||||
'id' => 'bootstrap',
|
||||
'basePath' => dirname(__DIR__),
|
||||
'extensions' => require(__DIR__ . '/../vendor/yii-extensions.php'),
|
||||
'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
|
||||
'components' => [
|
||||
'request' => [
|
||||
'enableCsrfValidation' => true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
The Yii framework is free software. It is released under the terms of
|
||||
the following BSD License.
|
||||
|
||||
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com)
|
||||
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -29,4 +29,4 @@ 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.
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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 colums of the corresponding database row.
|
||||
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
|
||||
|
||||
@@ -7,7 +7,7 @@ of controlling it.
|
||||
Access control basics
|
||||
---------------------
|
||||
|
||||
Basic acces control is very simple to implement using [[\yii\web\AccessControl]]:
|
||||
Basic access control is very simple to implement using [[\yii\web\AccessControl]]:
|
||||
|
||||
```php
|
||||
class SiteController extends Controller
|
||||
|
||||
@@ -121,7 +121,7 @@ extension. After installing and enabling it you will be able to use extended syn
|
||||
that allows you to specify formatting style.
|
||||
|
||||
Full reference is [available at ICU website](http://icu-project.org/apiref/icu4c/classMessageFormat.html) but since it's
|
||||
a bit crypric we have our own reference below.
|
||||
a bit cryptic we have our own reference below.
|
||||
|
||||
### Numbers
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ $query->select(['tbl_user.name AS author', 'tbl_post.title as title']) // <-- sp
|
||||
->leftJoin('tbl_post', 'tbl_post.user_id = tbl_user.id'); // <-- join with another table
|
||||
```
|
||||
|
||||
In the code above we've used `leftJoin` method to select from two related tables at the same time. Firsrt parameter
|
||||
In the code above we've used `leftJoin` method to select from two related tables at the same time. First parameter
|
||||
specifies table name and the second is the join condition. Query builder has the following methods to join tables:
|
||||
|
||||
- `innerJoin`
|
||||
|
||||
@@ -8,7 +8,7 @@ Standard Yii validators
|
||||
-----------------------
|
||||
|
||||
Standard Yii validators could be specified using aliases instead of referring to class names. Here's the list of all
|
||||
validators budled with Yii with their most useful properties:
|
||||
validators bundled with Yii with their most useful properties:
|
||||
|
||||
### `boolean`: [[BooleanValidator]]
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ Widgets
|
||||
|
||||
Widgets are a self-contained building blocks for your views. A widget may contain advanced logic, typically takes some
|
||||
configuration and data and returns HTML. There is a good number of widgets bundled with Yii such as [active form](form.md),
|
||||
breadcrumbs, menu or [wrappers around bootstrap component framework](boostrap-widgets.md). Additionally there are
|
||||
breadcrumbs, menu or [wrappers around bootstrap component framework](bootstrap-widgets.md). Additionally there are
|
||||
extensions providing additional widgets such as official one for jQueryUI components.
|
||||
|
||||
In order to use widget you need to do the following:
|
||||
|
||||
@@ -85,13 +85,13 @@ class Installer extends LibraryInstaller
|
||||
|
||||
protected function loadExtensions()
|
||||
{
|
||||
$file = $this->vendorDir . '/yii-extensions.php';
|
||||
$file = $this->vendorDir . '/yiisoft/extensions.php';
|
||||
return is_file($file) ? require($file) : [];
|
||||
}
|
||||
|
||||
protected function saveExtensions(array $extensions)
|
||||
{
|
||||
$file = $this->vendorDir . '/yii-extensions.php';
|
||||
$file = $this->vendorDir . '/yiisoft/extensions.php';
|
||||
file_put_contents($file, "<?php\nreturn " . var_export($extensions, true) . ";\n");
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
The Yii framework is free software. It is released under the terms of
|
||||
the following BSD License.
|
||||
|
||||
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com)
|
||||
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -26,8 +26,9 @@ class Plugin implements PluginInterface
|
||||
{
|
||||
$installer = new Installer($io, $composer);
|
||||
$composer->getInstallationManager()->addInstaller($installer);
|
||||
$file = rtrim($composer->getConfig()->get('vendor-dir'), '/') . '/yii-extensions.php';
|
||||
$file = rtrim($composer->getConfig()->get('vendor-dir'), '/') . '/yiisoft/extensions.php';
|
||||
if (!is_file($file)) {
|
||||
@mkdir(dirname($file));
|
||||
file_put_contents($file, "<?php\nreturn [];\n");
|
||||
}
|
||||
}
|
||||
@@ -1,44 +1,65 @@
|
||||
Yii 2.0 Public Preview - Composer Installer
|
||||
===========================================
|
||||
|
||||
Thank you for choosing Yii - a high-performance component-based PHP framework.
|
||||
|
||||
If you are looking for a production-ready PHP framework, please use
|
||||
[Yii v1.1](https://github.com/yiisoft/yii).
|
||||
|
||||
Yii 2.0 is still under heavy development. We may make significant changes
|
||||
without prior notices. **Yii 2.0 is not ready for production use yet.**
|
||||
Yii 2 Composer Installer
|
||||
========================
|
||||
|
||||
[](http://travis-ci.org/yiisoft/yii2)
|
||||
|
||||
This is the yii2 composer installer.
|
||||
This is the composer installer for Yii 2 extensions. It implements a new composer package type named `yii2-extension`,
|
||||
which should be used by all Yii 2 extensions if they are distributed as composer packages.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
Usage
|
||||
-----
|
||||
|
||||
This extension offers you enhanced Composer handling for your yii2-project. It will therefore require you to use Composer.
|
||||
To use Yii 2 composer installer, simply set `type` to be `yii2-extension` in your `composer.json`,
|
||||
like the following:
|
||||
|
||||
```
|
||||
php composer.phar require yiisoft/yii2-composer "*"
|
||||
```json
|
||||
{
|
||||
"type": "yii2-extension",
|
||||
"require": {
|
||||
"yiisoft/yii2": "*"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
*Note: You might have to run `php composer.phar selfupdate` before using this extension.*
|
||||
You may specify a bootstrap class in the `extra` section. The `init()` method of the class will be executed each time
|
||||
the Yii 2 application is responding to a request. For example,
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "yii2-extension",
|
||||
...,
|
||||
"extra": {
|
||||
"bootstrap": "yii\\jui\\Extension"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Usage & Documentation
|
||||
---------------------
|
||||
The `Installer` class also implements a static method `setPermission()` that can be called after
|
||||
a Yii 2 projected is installed, through the `post-create-project-cmd` composer script.
|
||||
The method will set specified directories or files to be writable or executable, depending on
|
||||
the corresponding parameters set in the `extra` section of the `composer.json` file.
|
||||
For example,
|
||||
|
||||
This extension allows you to hook to certain composer events and automate preparing your Yii2 application for further usage.
|
||||
|
||||
After the package is installed, the `composer.json` file has to be modified to enable this extension.
|
||||
|
||||
To see it in action take a look at the example apps in the repository:
|
||||
|
||||
- [Basic](https://github.com/suralc/yii2/blob/master/apps/basic/composer.json#L27)
|
||||
- [Advanced](https://github.com/suralc/yii2/blob/extensions-readme/apps/advanced/composer.json)
|
||||
|
||||
However it might be useful to read through the official composer [documentation](http://getcomposer.org/doc/articles/scripts.md)
|
||||
to understand what this extension can do for you and what it can't.
|
||||
|
||||
You can also use this as a template to create your own composer additions to ease development and deployment of your app.
|
||||
```json
|
||||
{
|
||||
"name": "yiisoft/yii2-app-basic",
|
||||
"type": "project",
|
||||
...
|
||||
"scripts": {
|
||||
"post-create-project-cmd": [
|
||||
"yii\\composer\\Installer::setPermission"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"writable": [
|
||||
"runtime",
|
||||
"web/assets"
|
||||
],
|
||||
"executable": [
|
||||
"yii"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"autoload": {
|
||||
"psr-0": { "yii\\composer\\": "" }
|
||||
},
|
||||
"target-dir": "yii/composer",
|
||||
"extra": {
|
||||
"class": "yii\\composer\\Plugin"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
The Yii framework is free software. It is released under the terms of
|
||||
the following BSD License.
|
||||
|
||||
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com)
|
||||
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 212 B |
|
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 208 B |
|
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 335 B |
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 280 B |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
@@ -18,6 +18,7 @@
|
||||
"autoload": {
|
||||
"psr-0": { "yii\\jui\\": "" }
|
||||
},
|
||||
"target-dir": "yii/jui",
|
||||
"extra": {
|
||||
"bootstrap": "yii\\jui\\Extension"
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
The Yii framework is free software. It is released under the terms of
|
||||
the following BSD License.
|
||||
|
||||
Copyright © 2008-2013 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.
|
||||