Commit b7e493fc by Carsten Brandt

Tabs to spaces to be consistent

``` vendor/bin/indent --spaces -r framework/ vendor/bin/indent --tabs -r . --pattern=*.json vendor/bin/indent --spaces -r . --pattern=*.md vendor/bin/indent --spaces -r . --pattern=yii.*.js vendor/bin/indent --spaces -r . --pattern=*.css ```
parent 175d1325
html,
body {
height: 100%;
height: 100%;
}
.wrap {
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
}
.wrap > .container {
......@@ -15,61 +15,61 @@ body {
}
.footer {
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding-top: 20px;
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding-top: 20px;
}
.jumbotron {
text-align: center;
background-color: transparent;
text-align: center;
background-color: transparent;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
font-size: 21px;
padding: 14px 24px;
}
.not-set {
color: #c55;
font-style: italic;
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;
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";
content: /*"\e113"*/ "\e151";
}
a.desc:after {
content: /*"\e114"*/ "\e152";
content: /*"\e114"*/ "\e152";
}
.sort-numerical a.asc:after {
content: "\e153";
content: "\e153";
}
.sort-numerical a.desc:after {
content: "\e154";
content: "\e154";
}
.sort-ordinal a.asc:after {
content: "\e155";
content: "\e155";
}
.sort-ordinal a.desc:after {
content: "\e156";
content: "\e156";
}
.grid-view th {
......@@ -77,15 +77,15 @@ a.desc:after {
}
.hint-block {
display: block;
margin-top: 5px;
color: #999;
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;
color: #a94442;
background: #fdf7f7;
border-left: 3px solid #eed3d7;
padding: 10px 20px;
margin: 0 0 15px 0;
}
html,
body {
height: 100%;
height: 100%;
}
.wrap {
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
}
.wrap > .container {
......@@ -15,61 +15,61 @@ body {
}
.footer {
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding-top: 20px;
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding-top: 20px;
}
.jumbotron {
text-align: center;
background-color: transparent;
text-align: center;
background-color: transparent;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
font-size: 21px;
padding: 14px 24px;
}
.not-set {
color: #c55;
font-style: italic;
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;
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";
content: /*"\e113"*/ "\e151";
}
a.desc:after {
content: /*"\e114"*/ "\e152";
content: /*"\e114"*/ "\e152";
}
.sort-numerical a.asc:after {
content: "\e153";
content: "\e153";
}
.sort-numerical a.desc:after {
content: "\e154";
content: "\e154";
}
.sort-ordinal a.asc:after {
content: "\e155";
content: "\e155";
}
.sort-ordinal a.desc:after {
content: "\e156";
content: "\e156";
}
.grid-view th {
......@@ -77,15 +77,15 @@ a.desc:after {
}
.hint-block {
display: block;
margin-top: 5px;
color: #999;
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;
color: #a94442;
background: #fdf7f7;
border-left: 3px solid #eed3d7;
padding: 10px 20px;
margin: 0 0 15px 0;
}
......@@ -75,11 +75,11 @@ Edit the file `config/db.php` with real data, for example:
```php
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=yii2basic',
'username' => 'root',
'password' => '1234',
'charset' => 'utf8',
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=yii2basic',
'username' => 'root',
'password' => '1234',
'charset' => 'utf8',
];
```
......
html,
body {
height: 100%;
height: 100%;
}
.wrap {
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
}
.wrap > .container {
......@@ -15,61 +15,61 @@ body {
}
.footer {
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding-top: 20px;
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding-top: 20px;
}
.jumbotron {
text-align: center;
background-color: transparent;
text-align: center;
background-color: transparent;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
font-size: 21px;
padding: 14px 24px;
}
.not-set {
color: #c55;
font-style: italic;
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;
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";
content: /*"\e113"*/ "\e151";
}
a.desc:after {
content: /*"\e114"*/ "\e152";
content: /*"\e114"*/ "\e152";
}
.sort-numerical a.asc:after {
content: "\e153";
content: "\e153";
}
.sort-numerical a.desc:after {
content: "\e154";
content: "\e154";
}
.sort-ordinal a.asc:after {
content: "\e155";
content: "\e155";
}
.sort-ordinal a.desc:after {
content: "\e156";
content: "\e156";
}
.grid-view th {
......@@ -77,15 +77,15 @@ a.desc:after {
}
.hint-block {
display: block;
margin-top: 5px;
color: #999;
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;
color: #a94442;
background: #fdf7f7;
border-left: 3px solid #eed3d7;
padding: 10px 20px;
margin: 0 0 15px 0;
}
......@@ -83,7 +83,8 @@
"twig/twig": "*",
"smarty/smarty": "*",
"imagine/imagine": "v0.5.0",
"swiftmailer/swiftmailer": "*"
"swiftmailer/swiftmailer": "*",
"cebe/indent": "*"
},
"suggest": {
"phpdocumentor/reflection": "required by yii2-apidoc extension",
......
......@@ -52,11 +52,11 @@ connection `DSN` doesn't indicate uniquely what database type is being used. Tha
```php
'db' => [
'class' => 'yii\db\Connection',
'driverName' => 'mysql',
'dsn' => 'odbc:Driver={MySQL};Server=localhost;Database=test',
'username' => 'root',
'password' => '',
'class' => 'yii\db\Connection',
'driverName' => 'mysql',
'dsn' => 'odbc:Driver={MySQL};Server=localhost;Database=test',
'username' => 'root',
'password' => '',
],
```
......
......@@ -293,8 +293,8 @@ $searchModel = new PostSearch();
$dataProvider = $searchModel->search($_GET);
return $this->render('myview', [
'dataProvider' => $dataProvider,
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'searchModel' => $searchModel,
]);
```
......@@ -303,7 +303,7 @@ And in the view you then assign the `$dataProvider` and `$searchModel` to the Gr
```php
echo GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'filterModel' => $searchModel,
]);
```
......
......@@ -149,14 +149,14 @@ life cycle:
4. Initialize the application with [CApplication::init()]
- Register application behaviors;
- Load static application components;
- Load static application components;
5. Raise an [onBeginRequest|CApplication::onBeginRequest] event;
6. Process the user request:
- Collect information about the request;
- Create a controller;
- Run the controller;
- Collect information about the request;
- Create a controller;
- Run the controller;
7. Raise an [onEndRequest|CApplication::onEndRequest] event;
......@@ -64,7 +64,7 @@ The term "class" refers to all classes and interfaces here.
*/
class MyClass extends \yii\Object implements MyInterface
{
// code
// code
}
```
......@@ -77,8 +77,8 @@ For example:
<?php
class Foo
{
const VERSION = '1.0';
const DATE_APPROVED = '2012-06-01';
const VERSION = '1.0';
const DATE_APPROVED = '2012-06-01';
}
```
### 4.2. Properties
......@@ -101,9 +101,9 @@ For example:
<?php
class Foo
{
public $publicProp;
protected $protectedProp;
private $_privateProp;
public $publicProp;
protected $protectedProp;
private $_privateProp;
}
```
......@@ -121,14 +121,14 @@ class Foo
*/
class Foo
{
/**
* Documentation
*/
public function bar()
{
// code
return $value;
}
/**
* Documentation
*/
public function bar()
{
// code
return $value;
}
}
~~~
......@@ -150,8 +150,8 @@ Use the following format for associative arrays:
```php
$config = [
'name' => 'Yii',
'options' => ['usePHP' => true],
'name' => 'Yii',
'options' => ['usePHP' => true],
];
```
......@@ -161,8 +161,8 @@ Changing type of an existing variable is considered as a bad practice. Try not t
```php
public function save(Transaction $transaction, $argument2 = 100)
{
$transaction = new Connection; // bad
$argument2 = 200; // good
$transaction = new Connection; // bad
$argument2 = 200; // good
}
```
......@@ -201,8 +201,8 @@ When string is long format is the following:
```php
$sql = "SELECT *"
. "FROM `post` "
. "WHERE `id` = 121 ";
. "FROM `post` "
. "WHERE `id` = 121 ";
```
### 5.3 arrays
......@@ -223,9 +223,9 @@ If there are too many elements for a single line:
```php
$arr = [
3, 14, 15,
92, 6, $test,
'Yii', 'Framework',
3, 14, 15,
92, 6, $test,
'Yii', 'Framework',
];
```
......@@ -235,8 +235,8 @@ Use the following format for associative arrays:
```php
$config = [
'name' => 'Yii',
'options' => ['usePHP' => true],
'name' => 'Yii',
'options' => ['usePHP' => true],
];
```
......@@ -250,16 +250,16 @@ $config = [
```php
if ($event === null) {
return new Event();
return new Event();
} elseif ($event instanceof CoolEvent) {
return $event->instance();
return $event->instance();
} else {
return null;
return null;
}
// the following is NOT allowed:
if (!$model && null === $event)
throw new Exception('test');
throw new Exception('test');
```
#### switch
......@@ -268,18 +268,18 @@ Use the following formatting for switch:
```php
switch ($this->phpType) {
case 'string':
$a = (string)$value;
break;
case 'integer':
case 'int':
$a = (integer)$value;
break;
case 'boolean':
$a = (boolean)$value;
break;
default:
$a = null;
case 'string':
$a = (string)$value;
break;
case 'integer':
case 'int':
$a = (integer)$value;
break;
case 'boolean':
$a = (boolean)$value;
break;
default:
$a = null;
}
```
......@@ -291,8 +291,8 @@ doIt(2, 3);
doIt(['a' => 'b']);
doIt('a', [
'a' => 'b',
'c' => 'd',
'a' => 'b',
'c' => 'd',
]);
```
......@@ -304,17 +304,17 @@ Note space between `function`/`use` tokens and open parenthesis:
// good
$n = 100;
$sum = array_reduce($numbers, function ($r, $x) use ($n) {
$this->doMagic();
$r += $x * $n;
return $r;
$this->doMagic();
$r += $x * $n;
return $r;
});
// bad
$n = 100;
$mul = array_reduce($numbers, function($r, $x) use($n) {
$this->doMagic();
$r *= $x * $n;
return $r;
$this->doMagic();
$r *= $x * $n;
return $r;
});
```
......@@ -336,17 +336,17 @@ Documentation
in `@return`. Here is an example:
```php
<?php
/**
* Returns the errors for all attribute or a single attribute.
* @param string $attribute attribute name. Use null to retrieve errors for all attributes.
* @property array An array of errors for all attributes. Empty array is returned if no error.
* The result is a two-dimensional array. See [[getErrors()]] for detailed description.
* @return array errors for all attributes or the specified attribute. Empty array is returned if no error.
* Note that when returning errors for all attributes, the result is a two-dimensional array, like the following:
* ...
*/
public function getErrors($attribute = null)
<?php
/**
* Returns the errors for all attribute or a single attribute.
* @param string $attribute attribute name. Use null to retrieve errors for all attributes.
* @property array An array of errors for all attributes. Empty array is returned if no error.
* The result is a two-dimensional array. See [[getErrors()]] for detailed description.
* @return array errors for all attributes or the specified attribute. Empty array is returned if no error.
* Note that when returning errors for all attributes, the result is a two-dimensional array, like the following:
* ...
*/
public function getErrors($attribute = null)
```
#### File
......@@ -393,11 +393,11 @@ class Component extends \yii\base\Object
*/
public function getEventHandlers($name)
{
if (!isset($this->_e[$name])) {
$this->_e[$name] = new Vector;
}
$this->ensureBehaviors();
return $this->_e[$name];
if (!isset($this->_e[$name])) {
$this->_e[$name] = new Vector;
}
$this->ensureBehaviors();
return $this->_e[$name];
}
```
......
......@@ -26,26 +26,26 @@ $this->title = 'Posts';
?>
<!-- Separate PHP blocks are preferred for foreach, for, if etc. -->
<?php foreach ($posts as $post): ?>
<!-- Note indentation level here. -->
<h2><?= Html::encode($post['title']) ?></h2>
<p><?= Html::encode($post['shortDescription']) ?></p>
<!-- Note indentation level here. -->
<h2><?= Html::encode($post['title']) ?></h2>
<p><?= Html::encode($post['shortDescription']) ?></p>
<!-- `endforeach;`, `endfor;`, `endif;`, etc. should be used instead of `}` in case multiple PHP blocks are used -->
<?php endforeach; ?>
<!-- Widget declaration may or may not be exploded into multiple LOCs. -->
<?php $form = ActiveForm::begin([
'options' => ['id' => 'contact-message-form'],
'fieldConfig' => ['inputOptions' => ['class' => 'common-input']],
'options' => ['id' => 'contact-message-form'],
'fieldConfig' => ['inputOptions' => ['class' => 'common-input']],
]); ?>
<!-- Note indentation level here. -->
<?= $form->field($contactMessage, 'name')->textInput() ?>
<?= $form->field($contactMessage, 'email')->textInput() ?>
<?= $form->field($contactMessage, 'subject')->textInput() ?>
<?= $form->field($contactMessage, 'body')->textArea(['rows' => 6]) ?>
<div class="form-actions">
<?= Html::submitButton('Submit', ['class' => 'common-button']) ?>
</div>
<!-- Note indentation level here. -->
<?= $form->field($contactMessage, 'name')->textInput() ?>
<?= $form->field($contactMessage, 'email')->textInput() ?>
<?= $form->field($contactMessage, 'subject')->textInput() ?>
<?= $form->field($contactMessage, 'body')->textArea(['rows' => 6]) ?>
<div class="form-actions">
<?= Html::submitButton('Submit', ['class' => 'common-button']) ?>
</div>
<!-- Ending widget call should have individual PHP tag. -->
<?php ActiveForm::end(); ?>
<!-- Trailing newline character is mandatory. -->
......
......@@ -17,7 +17,7 @@
"email": "mail@cebe.cc"
}
],
"minimum-stability": "dev",
"minimum-stability": "dev",
"require": {
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
......
......@@ -16,15 +16,15 @@ use yii\helpers\StringHelper;
class ApiIndexer extends Indexer
{
protected function generateFileInfo($file, $contents, $basePath, $baseUrl)
{
// create file entry
if (preg_match('~<h1>(.*?)</h1>~s', $contents, $matches)) {
$title = str_replace('&para;', '', strip_tags($matches[1]));
} elseif (preg_match('~<title>(.*?)</title>~s', $contents, $matches)) {
$title = strip_tags($matches[1]);
} else {
$title = '<i>No title</i>';
}
{
// create file entry
if (preg_match('~<h1>(.*?)</h1>~s', $contents, $matches)) {
$title = str_replace('&para;', '', strip_tags($matches[1]));
} elseif (preg_match('~<title>(.*?)</title>~s', $contents, $matches)) {
$title = strip_tags($matches[1]);
} else {
$title = '<i>No title</i>';
}
if (preg_match('~<div id="classDescription">\s*<strong>(.*?)</strong>~s', $contents, $matches)) {
$description = strip_tags($matches[1]);
......@@ -37,24 +37,24 @@ class ApiIndexer extends Indexer
$description = '';
}
return [
'u' => $baseUrl . str_replace('\\', '/', substr($file, strlen(rtrim($basePath, '\\/')))),
't' => $title,
'd' => $description,
];
}
return [
'u' => $baseUrl . str_replace('\\', '/', substr($file, strlen(rtrim($basePath, '\\/')))),
't' => $title,
'd' => $description,
];
}
/**
* @return TokenizerInterface
*/
public function getTokenizer()
{
* @return TokenizerInterface
*/
public function getTokenizer()
{
$tokenizer = parent::getTokenizer();
if ($tokenizer instanceof StandardTokenizer) {
// yii is part of every doc and makes weird search results
$tokenizer->stopWords[] = 'yii';
$tokenizer->stopWords = array_unique($tokenizer->stopWords);
}
return $tokenizer;
}
return $tokenizer;
}
}
\ No newline at end of file
......@@ -24,7 +24,7 @@ code {
}
div.code {
display: none;
display: none;
color: #000000;
background-color: #FFF5E6;
font-family: "courier new", "times new roman", monospace;
......@@ -43,57 +43,57 @@ div.code {
}
table.summaryTable {
background: #E6ECFF;
border-collapse: collapse;
width: 100%;
background: #E6ECFF;
border-collapse: collapse;
width: 100%;
}
table.summaryTable th, table.summaryTable td {
border: 1px #BFCFFF solid;
padding: 0.2em;
border: 1px #BFCFFF solid;
padding: 0.2em;
}
table.summaryTable th {
background: #CCD9FF;
text-align: left;
background: #CCD9FF;
text-align: left;
}
#nav {
padding: 3px;
margin: 0 0 10px 0;
border-top: 1px #BFCFFF solid;
padding: 3px;
margin: 0 0 10px 0;
border-top: 1px #BFCFFF solid;
}
#classDescription {
padding: 5px;
margin: 10px 0 20px 0;
border-bottom: 1px solid #BFCFFF;
padding: 5px;
margin: 10px 0 20px 0;
border-bottom: 1px solid #BFCFFF;
}
.detailHeader {
font-weight: bold;
font-size: 12pt;
margin: 30px 0 5px 0;
border-bottom: 1px solid #BFCFFF;
font-weight: bold;
font-size: 12pt;
margin: 30px 0 5px 0;
border-bottom: 1px solid #BFCFFF;
}
.detailHeaderTag {
font-weight: normal;
font-size: 10pt;
font-weight: normal;
font-size: 10pt;
}
.paramNameCol {
width: 12%;
font-weight: bold;
width: 12%;
font-weight: bold;
}
.paramTypeCol {
width: 12%;
width: 12%;
}
.sourceCode {
margin: 5px 0;
padding:5px;
background:#FFF5E6;
margin: 5px 0;
padding:5px;
background:#FFF5E6;
}
\ No newline at end of file
html,
body {
height: 100%;
height: 100%;
}
.guide-content, .api-content {
max-width: 1250px;
max-width: 1250px;
}
.wrap {
min-height: 100%;
height: auto;
width: auto;
margin: 60px 30px 0 30px;
padding: 0;
min-height: 100%;
height: auto;
width: auto;
margin: 60px 30px 0 30px;
padding: 0;
}
.footer {
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding: 20px 30px;
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding: 20px 30px;
}
#navigation {
margin-top: 20px;
margin-top: 20px;
}
.submenu a {
background: #f5f5f5;
border-radius: 0;
background: #f5f5f5;
border-radius: 0;
}
.submenu a:hover, .submenu a:active,
.submenu a.active, .submenu a.active:hover, .submenu a.active:active {
background: #44b5f6;
border-color: #44b5f6;
border-radius: 0;
color: #fff;
background: #44b5f6;
border-color: #44b5f6;
border-radius: 0;
color: #fff;
}
.signature, .table-striped > tbody > tr > td.signature {
margin: 10px 0 10px 0;
padding: 8px;
margin: 10px 0 10px 0;
padding: 8px;
color: #000000;
background: rgba(230, 236, 255, 0.81);
border: 1px rgba(191, 207, 255, 0.81) solid;
color: #000000;
background: rgba(230, 236, 255, 0.81);
border: 1px rgba(191, 207, 255, 0.81) solid;
font-family: "courier new", "times new roman", monospace;
line-height: 1.3em;
white-space: pre-line;
word-wrap: break-word;
word-break: break-all;
font-family: "courier new", "times new roman", monospace;
line-height: 1.3em;
white-space: pre-line;
word-wrap: break-word;
word-break: break-all;
}
blockquote {
font-size: 14px;
font-size: 14px;
}
td p {
margin: 0;
margin: 0;
}
table.detail-table .param-name-col { width: 15%; min-width: 100px; }
......@@ -73,41 +73,41 @@ table.summary-table .col-event { width: 20%; }
table.summary-table .col-defined { width: 15%; }
.detail-header {
margin-top: 30px;
margin-top: 30px;
}
.doc-description {
border-left: solid 1px #ddd;
border-right: solid 1px #ddd;
padding: 10px 8px;
margin: 0;
border-left: solid 1px #ddd;
border-right: solid 1px #ddd;
padding: 10px 8px;
margin: 0;
}
.event-doc .doc-description {
border-bottom: solid 1px #ddd;
border-bottom: solid 1px #ddd;
}
.doc-description p:last-child {
margin-bottom: 0;
margin-bottom: 0;
}
.tool-link {
float: right;
color: #ddd;
margin: 0 8px;
float: right;
color: #ddd;
margin: 0 8px;
}
.icon-hash:before {
content: '#';
font-size: 32px;
font-weight: bold;
/*top: -10px;*/
line-height: 0.5;
content: '#';
font-size: 32px;
font-weight: bold;
/*top: -10px;*/
line-height: 0.5;
}
.tool-link:hover {
color: #bbb;
text-decoration: none;
color: #bbb;
text-decoration: none;
}
......
......@@ -182,23 +182,23 @@ use yii\authclient\OAuth2;
class MyAuthClient extends OAuth2
{
protected function defaultName()
{
return 'my_auth_client';
}
protected function defaultTitle()
{
return 'My Auth Client';
}
protected function defaultViewOptions()
{
return [
'popupWidth' => 800,
'popupHeight' => 500,
];
}
protected function defaultName()
{
return 'my_auth_client';
}
protected function defaultTitle()
{
return 'My Auth Client';
}
protected function defaultViewOptions()
{
return [
'popupWidth' => 800,
'popupHeight' => 500,
];
}
}
```
......@@ -215,16 +215,16 @@ use yii\authclient\OpenId;
class MyAuthClient extends OpenId
{
public $authUrl = 'https://www.my.com/openid/';
public $authUrl = 'https://www.my.com/openid/';
public $requiredAttributes = [
'contact/email',
];
public $requiredAttributes = [
'contact/email',
];
public $optionalAttributes = [
'namePerson/first',
'namePerson/last',
];
public $optionalAttributes = [
'namePerson/first',
'namePerson/last',
];
}
```
......@@ -243,16 +243,16 @@ use yii\authclient\OAuth2;
class MyAuthClient extends OAuth2
{
public $authUrl = 'https://www.my.com/oauth2/auth';
public $authUrl = 'https://www.my.com/oauth2/auth';
public $tokenUrl = 'https://www.my.com/oauth2/token';
public $tokenUrl = 'https://www.my.com/oauth2/token';
public $apiBaseUrl = 'https://www.my.com/apis/oauth2/v1';
public $apiBaseUrl = 'https://www.my.com/apis/oauth2/v1';
protected function initUserAttributes()
{
return $this->api('userinfo', 'GET');
}
protected function initUserAttributes()
{
return $this->api('userinfo', 'GET');
}
}
```
......@@ -277,18 +277,18 @@ use yii\authclient\OAuth1;
class MyAuthClient extends OAuth1
{
public $authUrl = 'https://www.my.com/oauth/auth';
public $authUrl = 'https://www.my.com/oauth/auth';
public $requestTokenUrl = 'https://www.my.com/oauth/request_token';
public $requestTokenUrl = 'https://www.my.com/oauth/request_token';
public $accessTokenUrl = 'https://www.my.com/oauth/access_token';
public $accessTokenUrl = 'https://www.my.com/oauth/access_token';
public $apiBaseUrl = 'https://www.my.com/apis/oauth/v1';
public $apiBaseUrl = 'https://www.my.com/apis/oauth/v1';
protected function initUserAttributes()
{
return $this->api('userinfo', 'GET');
}
protected function initUserAttributes()
{
return $this->api('userinfo', 'GET');
}
}
```
......
{
"name": "yiisoft/yii2-bootstrap",
"description": "The Twitter Bootstrap extension for the Yii framework",
"keywords": ["yii2", "bootstrap"],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"support": {
"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"
},
"authors": [
{
"name": "Qiang Xue",
"email": "qiang.xue@gmail.com"
}
],
"require": {
"yiisoft/yii2": "*",
"twbs/bootstrap": "3.1.* | 3.0.*"
},
"autoload": {
"psr-4": {
"yii\\bootstrap\\": ""
}
}
"name": "yiisoft/yii2-bootstrap",
"description": "The Twitter Bootstrap extension for the Yii framework",
"keywords": ["yii2", "bootstrap"],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"support": {
"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"
},
"authors": [
{
"name": "Qiang Xue",
"email": "qiang.xue@gmail.com"
}
],
"require": {
"yiisoft/yii2": "*",
"twbs/bootstrap": "3.1.* | 3.0.*"
},
"autoload": {
"psr-4": {
"yii\\bootstrap\\": ""
}
}
}
......@@ -69,7 +69,7 @@ use Codeception\Event\TestEvent;
public function testSomething()
{
$this->fire('myevent', new TestEvent($this));
$this->fire('myevent', new TestEvent($this));
}
```
this event can be catched in modules and helpers. If your test is in the group, then event name will be followed by the groupname,
......@@ -84,15 +84,15 @@ Execution of special tests methods is (for example on ```UserTest``` class):
```
tests\unit\models\UserTest::setUpBeforeClass();
tests\unit\models\UserTest::_before();
tests\unit\models\UserTest::_before();
tests\unit\models\UserTest::setUp();
tests\unit\models\UserTest::setUp();
tests\unit\models\UserTest::testSomething();
tests\unit\models\UserTest::testSomething();
tests\unit\models\UserTest::tearDown();
tests\unit\models\UserTest::tearDown();
tests\unit\models\UserTest::_after();
tests\unit\models\UserTest::_after();
tests\unit\models\UserTest::tearDownAfterClass();
```
......@@ -109,8 +109,8 @@ You may need to specify different configuration files per test cases, to do this
SomeConsoleTest extends \yii\codeception\TestCase
{
// this is the config file to load as application config
public $appConfig = '@app/path/to/my/custom/config/for/test.php';
// this is the config file to load as application config
public $appConfig = '@app/path/to/my/custom/config/for/test.php';
}
```
......@@ -120,14 +120,14 @@ application class in the config, for example for testing console commands or fea
```php
return yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../config/console.php'),
require(__DIR__ . '/../_config.php'),
[
'class' => 'yii\console\Application',
'components' => [
//override console components if needed
],
]
require(__DIR__ . '/../../config/console.php'),
require(__DIR__ . '/../_config.php'),
[
'class' => 'yii\console\Application',
'components' => [
//override console components if needed
],
]
);
```
......@@ -139,7 +139,7 @@ use \yii\codeception\TestCase;
class ConsoleTestCase extends TestCase
{
public $appConfig = '@tests/unit/_console.php';
public $appConfig = '@tests/unit/_console.php';
}
```
......@@ -160,15 +160,15 @@ use Yii;
class MailTest extends TestCase
{
protected function setUp()
{
// don't forget to call parent method that will setup Yii application
parent::setUp();
protected function setUp()
{
// don't forget to call parent method that will setup Yii application
parent::setUp();
Yii::$app->mail->fileTransportCallback = function ($mailer, $message) {
return 'testing_message.eml';
};
}
Yii::$app->mail->fileTransportCallback = function ($mailer, $message) {
return 'testing_message.eml';
};
}
}
```
......@@ -186,29 +186,29 @@ use \yii\codeception\TestCase;
class SomeMyTest extends TestCase
{
public function testOne()
{
...
}
public function testTwo()
{
$this->mockApplication([
'language' => 'ru-RU',
'components' => [
'db' => [
//your custom configuration here
],
],
]);
//your expectations and assertions goes here
}
public function testThree()
{
...
}
public function testOne()
{
...
}
public function testTwo()
{
$this->mockApplication([
'language' => 'ru-RU',
'components' => [
'db' => [
//your custom configuration here
],
],
]);
//your expectations and assertions goes here
}
public function testThree()
{
...
}
}
```
......@@ -226,12 +226,12 @@ use Codeception\Util\Debug;
SomeDebugTest extends \yii\codeception\TestCase
{
public function testSmth()
{
Debug::debug('some string');
Debug::debug($someArray);
Debug::debug($someObject);
}
public function testSmth()
{
Debug::debug('some string');
Debug::debug($someArray);
Debug::debug($someObject);
}
}
```
......
......@@ -13,11 +13,11 @@ like the following:
```json
{
"type": "yii2-extension",
"require": {
"yiisoft/yii2": "*"
},
...
"type": "yii2-extension",
"require": {
"yiisoft/yii2": "*"
},
...
}
```
......@@ -26,11 +26,11 @@ the Yii 2 application is responding to a request. For example,
```json
{
"type": "yii2-extension",
...,
"extra": {
"bootstrap": "yii\\jui\\Extension"
}
"type": "yii2-extension",
...,
"extra": {
"bootstrap": "yii\\jui\\Extension"
}
}
```
......@@ -42,22 +42,22 @@ For example,
```json
{
"name": "yiisoft/yii2-app-basic",
"type": "project",
...
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::setPermission"
]
},
"extra": {
"writable": [
"runtime",
"web/assets"
],
"executable": [
"yii"
]
}
"name": "yiisoft/yii2-app-basic",
"type": "project",
...
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::setPermission"
]
},
"extra": {
"writable": [
"runtime",
"web/assets"
],
"executable": [
"yii"
]
}
}
```
span.indent {
color: #ccc;
color: #ccc;
}
ul.trace {
font-size: 12px;
color: #999;
margin: 2px 0 0 0;
padding: 0;
list-style: none;
white-space: normal;
font-size: 12px;
color: #999;
margin: 2px 0 0 0;
padding: 0;
list-style: none;
white-space: normal;
}
.callout-danger {
background-color: #fcf2f2;
border-color: #dFb5b4;
background-color: #fcf2f2;
border-color: #dFb5b4;
}
.callout {
margin: 0 0 10px 0;
padding: 5px;
margin: 0 0 10px 0;
padding: 5px;
}
.list-group .glyphicon {
float: right;
float: right;
}
td, th {
white-space: pre-wrap;
word-wrap: break-word;
white-space: pre-wrap;
word-wrap: break-word;
}
.request-table td {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
word-break: break-all;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
word-break: break-all;
}
.config-php-info-table td.v {
word-break: break-all;
word-break: break-all;
}
.not-set {
color: #c55;
font-style: italic;
color: #c55;
font-style: italic;
}
.detail-grid-view th {
......@@ -49,47 +49,47 @@ td, th {
/* 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;
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";
content: /*"\e113"*/ "\e151";
}
a.desc:after {
content: /*"\e114"*/ "\e152";
content: /*"\e114"*/ "\e152";
}
.sort-numerical a.asc:after {
content: "\e153";
content: "\e153";
}
.sort-numerical a.desc:after {
content: "\e154";
content: "\e154";
}
.sort-ordinal a.asc:after {
content: "\e155";
content: "\e155";
}
.sort-ordinal a.desc:after {
content: "\e156";
content: "\e156";
}
.mail-sorter {
margin-top: 7px;
margin-top: 7px;
}
.mail-sorter li {
list-style: none;
float: left;
width: 12%;
font-weight: bold;
list-style: none;
float: left;
width: 12%;
font-weight: bold;
}
......@@ -9,8 +9,8 @@ To use this extension, you have to configure the Connection class in your applic
```php
return [
//....
'components' => [
//....
'components' => [
'elasticsearch' => [
'class' => 'yii\elasticsearch\Connection',
'nodes' => [
......@@ -18,7 +18,7 @@ return [
// configure more hosts if you have a cluster
],
],
]
]
];
```
......@@ -152,11 +152,11 @@ $result = Article::find()->query(["field" => ["title" => "yii"]])->all(); // art
// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-flt-query.html
$query = Article::find()->query([
"fuzzy_like_this" => [
"fields" => ["title", "description"],
"like_text" => "This query will return articles that are similar to this text :-)",
"fuzzy_like_this" => [
"fields" => ["title", "description"],
"like_text" => "This query will return articles that are similar to this text :-)",
"max_query_terms" : 12
]
]
]);
$query->all(); // gives you all the documents
......@@ -179,19 +179,19 @@ Add the following to you application config to enable it (if you already have th
enabled, it is sufficient to just add the panels configuration):
```php
// ...
'bootstrap' => ['debug'],
'modules' => [
'debug' => [
'class' => 'yii\\debug\\Module',
'panels' => [
'elasticsearch' => [
'class' => 'yii\\elasticsearch\\DebugPanel',
],
],
],
],
// ...
// ...
'bootstrap' => ['debug'],
'modules' => [
'debug' => [
'class' => 'yii\\debug\\Module',
'panels' => [
'elasticsearch' => [
'class' => 'yii\\elasticsearch\\DebugPanel',
],
],
],
],
// ...
```
![elasticsearch DebugPanel](images/README-debug.png)
......
......@@ -31,9 +31,9 @@ To use this extension, simply add the following code in your application config
```php
'controllerMap' => [
'fixture' => [
'class' => 'yii\faker\FixtureController',
],
'fixture' => [
'class' => 'yii\faker\FixtureController',
],
],
```
Set valid ```test``` alias in your console config, for example for ```basic``` application template, this should be added
......@@ -44,17 +44,17 @@ generate fixtures template files, according to the given format:
```php
//users.php file under template path (by default @tests/unit/templates/fixtures)
return [
[
'table_column0' => 'faker_formatter',
...
'table_columnN' => 'other_faker_formatter'
'body' => function ($fixture, $faker, $index) {
//set needed fixture fields based on different conditions
$fixture['body'] = $faker->sentence(7,true); //generate sentence exact with 7 words.
return $fixture;
}
],
[
'table_column0' => 'faker_formatter',
...
'table_columnN' => 'other_faker_formatter'
'body' => function ($fixture, $faker, $index) {
//set needed fixture fields based on different conditions
$fixture['body'] = $faker->sentence(7,true); //generate sentence exact with 7 words.
return $fixture;
}
],
];
```
......@@ -72,17 +72,17 @@ Another example of valid template:
use yii\helpers\Security;
return [
'name' => 'firstName',
'phone' => 'phoneNumber',
'city' => 'city',
'password' => function ($fixture, $faker, $index) {
$fixture['password'] = Security::generatePasswordHash('password_' . $index);
return $fixture;
},
'auth_key' => function ($fixture, $faker, $index) {
$fixture['auth_key'] = Security::generateRandomKey();
return $fixture;
},
'name' => 'firstName',
'phone' => 'phoneNumber',
'city' => 'city',
'password' => function ($fixture, $faker, $index) {
$fixture['password'] = Security::generatePasswordHash('password_' . $index);
return $fixture;
},
'auth_key' => function ($fixture, $faker, $index) {
$fixture['auth_key'] = Security::generateRandomKey();
return $fixture;
},
];
```
......@@ -135,16 +135,16 @@ After you created custom provider, for example:
```php
class Book extends \Faker\Provider\Base
{
public function title($nbWords = 5)
{
$sentence = $this->generator->sentence($nbWords);
return mb_substr($sentence, 0, mb_strlen($sentence) - 1);
}
public function title($nbWords = 5)
{
$sentence = $this->generator->sentence($nbWords);
return mb_substr($sentence, 0, mb_strlen($sentence) - 1);
}
public function ISBN()
{
return $this->generator->randomNumber(13);
}
public function ISBN()
{
return $this->generator->randomNumber(13);
}
}
```
......@@ -153,11 +153,11 @@ You can use it by adding it to the ```$providers``` property of the current comm
```php
'controllerMap' => [
'fixture' => [
'class' => 'yii\faker\FixtureController',
'providers' => [
'app\tests\unit\faker\providers\Book',
],
],
'fixture' => [
'class' => 'yii\faker\FixtureController',
'providers' => [
'app\tests\unit\faker\providers\Book',
],
],
]
```
body {
padding-top: 70px;
padding-top: 70px;
}
.footer {
border-top: 1px solid #ddd;
margin-top: 30px;
padding: 15px 0 30px;
border-top: 1px solid #ddd;
margin-top: 30px;
padding: 15px 0 30px;
}
.jumbotron {
text-align: center;
background-color: transparent;
text-align: center;
background-color: transparent;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
font-size: 21px;
padding: 14px 24px;
}
.navbar-brand {
padding: 0;
margin: 0;
padding: 0;
margin: 0;
}
.default-index .generator {
min-height: 200px;
margin-bottom: 20px;
min-height: 200px;
margin-bottom: 20px;
}
.list-group .glyphicon {
float: right;
float: right;
}
.popover {
max-width: 400px;
width: 400px;
max-width: 400px;
width: 400px;
}
.hint-block {
display: none;
display: none;
}
.error-summary {
color: #a94442;
background: #fdf7f7;
border-left: 3px solid #eed3d7;
padding: 10px 20px;
margin: 0 0 15px 0;
color: #a94442;
background: #fdf7f7;
border-left: 3px solid #eed3d7;
padding: 10px 20px;
margin: 0 0 15px 0;
}
.default-view .sticky-value {
padding: 6px 12px;
background: lightyellow;
white-space: pre;
word-wrap: break-word;
padding: 6px 12px;
background: lightyellow;
white-space: pre;
word-wrap: break-word;
}
.default-view .form-group label.help {
border-bottom: 1px dashed #888;
cursor: help;
border-bottom: 1px dashed #888;
cursor: help;
}
.default-view .modal-dialog {
width: 800px;
width: 800px;
}
.default-view .modal-dialog .error {
color: #d9534f;
color: #d9534f;
}
.default-view .modal-dialog .content {
background: #fafafa;
border-left: #eee 5px solid;
padding: 5px 10px;
overflow: auto;
background: #fafafa;
border-left: #eee 5px solid;
padding: 5px 10px;
overflow: auto;
}
.default-view .modal-dialog code {
background: transparent;
background: transparent;
}
.default-view-files table .action {
width: 100px;
width: 100px;
}
.default-view-files table .check {
width: 25px;
text-align: center;
width: 25px;
text-align: center;
}
.default-view-results pre {
overflow: auto;
background-color: #333;
max-height: 300px;
color: white;
padding: 10px;
border-radius: 0;
white-space: nowrap;
overflow: auto;
background-color: #333;
max-height: 300px;
color: white;
padding: 10px;
border-radius: 0;
white-space: nowrap;
}
.default-view-results pre .error {
background: #FFE0E1;
color: black;
padding: 1px;
background: #FFE0E1;
color: black;
padding: 1px;
}
.default-view-results .alert pre {
background: white;
background: white;
}
.default-diff pre {
padding: 0;
margin: 0;
background: transparent;
border: none;
padding: 0;
margin: 0;
background: transparent;
border: none;
}
.default-diff pre del {
background: pink;
background: pink;
}
.default-diff pre ins {
background: lightgreen;
text-decoration: none;
background: lightgreen;
text-decoration: none;
}
.Differences {
width: 100%;
border-collapse: collapse;
border-spacing: 0;
empty-cells: show;
width: 100%;
border-collapse: collapse;
border-spacing: 0;
empty-cells: show;
}
.Differences thead {
display: none;
display: none;
}
.Differences tbody th {
text-align: right;
background: #FAFAFA;
padding: 1px 2px;
border-right: 1px solid #eee;
vertical-align: top;
font-size: 13px;
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
font-weight: normal;
color: #999;
width: 5px;
text-align: right;
background: #FAFAFA;
padding: 1px 2px;
border-right: 1px solid #eee;
vertical-align: top;
font-size: 13px;
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
font-weight: normal;
color: #999;
width: 5px;
}
.Differences td {
padding: 1px 2px;
font-size: 13px;
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
padding: 1px 2px;
font-size: 13px;
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
}
.DifferencesSideBySide .ChangeInsert td.Left {
background: #dfd;
background: #dfd;
}
.DifferencesSideBySide .ChangeInsert td.Right {
background: #cfc;
background: #cfc;
}
.DifferencesSideBySide .ChangeDelete td.Left {
background: #f88;
background: #f88;
}
.DifferencesSideBySide .ChangeDelete td.Right {
background: #faa;
background: #faa;
}
.DifferencesSideBySide .ChangeReplace .Left {
background: #fe9;
background: #fe9;
}
.DifferencesSideBySide .ChangeReplace .Right {
background: #fd8;
background: #fd8;
}
.Differences ins, .Differences del {
text-decoration: none;
text-decoration: none;
}
.DifferencesSideBySide .ChangeReplace ins, .DifferencesSideBySide .ChangeReplace del {
background: #fc0;
background: #fc0;
}
.Differences .Skipped {
background: #f7f7f7;
background: #f7f7f7;
}
.DifferencesInline .ChangeReplace .Left,
.DifferencesInline .ChangeDelete .Left {
background: #fdd;
background: #fdd;
}
.DifferencesInline .ChangeReplace .Right,
.DifferencesInline .ChangeInsert .Right {
background: #dfd;
background: #dfd;
}
.DifferencesInline .ChangeReplace ins {
background: #9e9;
background: #9e9;
}
.DifferencesInline .ChangeReplace del {
background: #e99;
background: #e99;
}
.DifferencesInline th[data-line-number]:before {
content: attr(data-line-number);
content: attr(data-line-number);
}
/* additional styles for typeahead.js-bootstrap.css */
......
{
"name": "<?= $generator->vendorName ?>/<?= $generator->packageName ?>",
"description": "<?= $generator->description ?>",
"type": "<?= $generator->type ?>",
"keywords": <?= $generator->keywordsArrayJson ?>,
"license": "<?= $generator->license ?>",
"authors": [
{
"name": "<?= $generator->authorName ?>",
"email": "<?= $generator->authorEmail ?>"
}
],
"autoload": {
"psr-4": {
"<?= str_replace('\\','\\\\',$generator->namespace) ?>": ""
}
}
"name": "<?= $generator->vendorName ?>/<?= $generator->packageName ?>",
"description": "<?= $generator->description ?>",
"type": "<?= $generator->type ?>",
"keywords": <?= $generator->keywordsArrayJson ?>,
"license": "<?= $generator->license ?>",
"authors": [
{
"name": "<?= $generator->authorName ?>",
"email": "<?= $generator->authorEmail ?>"
}
],
"autoload": {
"psr-4": {
"<?= str_replace('\\','\\\\',$generator->namespace) ?>": ""
}
}
}
{
"name": "yiisoft/yii2-imagine",
"description": "The Imagine integration for the Yii framework",
"keywords": ["yii2", "imagine", "image", "helper"],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?labels=ext%3Aimagine",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"authors": [
{
"name": "Antonio Ramirez",
"email": "amigo.cobos@gmail.com"
}
],
"require": {
"yiisoft/yii2": "*",
"imagine/imagine": "v0.5.0"
},
"autoload": {
"psr-4": {
"yii\\imagine\\": ""
}
}
"name": "yiisoft/yii2-imagine",
"description": "The Imagine integration for the Yii framework",
"keywords": ["yii2", "imagine", "image", "helper"],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?labels=ext%3Aimagine",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"authors": [
{
"name": "Antonio Ramirez",
"email": "amigo.cobos@gmail.com"
}
],
"require": {
"yiisoft/yii2": "*",
"imagine/imagine": "v0.5.0"
},
"autoload": {
"psr-4": {
"yii\\imagine\\": ""
}
}
}
......@@ -33,13 +33,13 @@ To use this extension, simply add the following code in your application configu
```php
return [
//....
'components' => [
'mongodb' => [
'class' => '\yii\mongodb\Connection',
'dsn' => 'mongodb://developer:password@localhost:27017/mydatabase',
],
],
//....
'components' => [
'mongodb' => [
'class' => '\yii\mongodb\Connection',
'dsn' => 'mongodb://developer:password@localhost:27017/mydatabase',
],
],
];
```
......@@ -59,8 +59,8 @@ use yii\mongodb\Query;
$query = new Query;
// compose the query
$query->select(['name', 'status'])
->from('customer')
->limit(10);
->from('customer')
->limit(10);
// execute the query
$rows = $query->all();
```
......@@ -103,17 +103,17 @@ use yii\mongodb\Query;
class ItemController extends Controller
{
/**
* @param string $id MongoId string (not object)
*/
public function actionUpdate($id)
{
$query = new Query;
$row = $query->from('item')
where(['_id' => $id]) // implicit typecast to [[\MongoId]]
->one();
...
}
/**
* @param string $id MongoId string (not object)
*/
public function actionUpdate($id)
{
$query = new Query;
$row = $query->from('item')
where(['_id' => $id]) // implicit typecast to [[\MongoId]]
->one();
...
}
}
```
......@@ -133,21 +133,21 @@ use yii\mongodb\ActiveRecord;
class Customer extends ActiveRecord
{
/**
* @return string the name of the index associated with this ActiveRecord class.
*/
public static function collectionName()
{
return 'customer';
}
/**
* @return array list of attribute names.
*/
public function attributes()
{
return ['_id', 'name', 'email', 'address', 'status'];
}
/**
* @return string the name of the index associated with this ActiveRecord class.
*/
public static function collectionName()
{
return 'customer';
}
/**
* @return array list of attribute names.
*/
public function attributes()
{
return ['_id', 'name', 'email', 'address', 'status'];
}
}
```
......@@ -162,10 +162,10 @@ use yii\mongodb\Query;
$query = new Query;
$query->from('customer')->where(['status' => 2]);
$provider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 10,
]
'query' => $query,
'pagination' => [
'pageSize' => 10,
]
]);
$models = $provider->getModels();
```
......@@ -175,10 +175,10 @@ use yii\data\ActiveDataProvider;
use app\models\Customer;
$provider = new ActiveDataProvider([
'query' => Customer::find(),
'pagination' => [
'pageSize' => 10,
]
'query' => Customer::find(),
'pagination' => [
'pageSize' => 10,
]
]);
$models = $provider->getModels();
```
......@@ -193,11 +193,11 @@ For example: instead of:
```
{
content: "some content",
author: {
name: author1,
email: author1@domain.com
}
content: "some content",
author: {
name: author1,
email: author1@domain.com
}
}
```
......@@ -205,9 +205,9 @@ use following:
```
{
content: "some content",
author_name: author1,
author_email: author1@domain.com
content: "some content",
author_name: author1,
author_email: author1@domain.com
}
```
......@@ -231,13 +231,13 @@ you also have to configure the `cache` component to be `yii\mongodb\Cache`:
```php
return [
//....
'components' => [
// ...
'cache' => [
'class' => 'yii\mongodb\Cache',
],
]
//....
'components' => [
// ...
'cache' => [
'class' => 'yii\mongodb\Cache',
],
]
];
```
......@@ -250,12 +250,12 @@ you also have to configure the `session` component to be `yii\mongodb\Session`:
```php
return [
//....
'components' => [
// ...
'session' => [
'class' => 'yii\mongodb\Session',
],
]
//....
'components' => [
// ...
'session' => [
'class' => 'yii\mongodb\Session',
],
]
];
```
\ No newline at end of file
......@@ -9,15 +9,15 @@ To use this extension, you have to configure the Connection class in your applic
```php
return [
//....
'components' => [
//....
'components' => [
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
]
]
];
```
......@@ -54,13 +54,13 @@ you also have to configure the `cache` component to be `yii\redis\Cache`:
```php
return [
//....
'components' => [
// ...
'cache' => [
'class' => 'yii\redis\Cache',
],
]
//....
'components' => [
// ...
'cache' => [
'class' => 'yii\redis\Cache',
],
]
];
```
......@@ -69,18 +69,18 @@ cache component (no connection application component needs to be configured in t
```php
return [
//....
'components' => [
// ...
'cache' => [
'class' => 'yii\redis\Cache',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
]
//....
'components' => [
// ...
'cache' => [
'class' => 'yii\redis\Cache',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
]
];
```
......@@ -92,13 +92,13 @@ you also have to configure the `session` component to be `yii\redis\Session`:
```php
return [
//....
'components' => [
// ...
'session' => [
'class' => 'yii\redis\Session',
],
]
//....
'components' => [
// ...
'session' => [
'class' => 'yii\redis\Session',
],
]
];
```
......@@ -107,18 +107,18 @@ cache component (no connection application component needs to be configured in t
```php
return [
//....
'components' => [
// ...
'session' => [
'class' => 'yii\redis\Session',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
]
//....
'components' => [
// ...
'session' => [
'class' => 'yii\redis\Session',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
],
]
];
```
......@@ -139,29 +139,29 @@ The following is an example model called `Customer`:
```php
class Customer extends \yii\redis\ActiveRecord
{
/**
* @return array the list of attributes for this record
*/
public function attributes()
{
return ['id', 'name', 'address', 'registration_date'];
}
/**
* @return ActiveQuery defines a relation to the Order record (can be in other database, e.g. elasticsearch or sql)
*/
public function getOrders()
{
return $this->hasMany(Order::className(), ['customer_id' => 'id']);
}
/**
* Defines a scope that modifies the `$query` to return only active(status = 1) customers
*/
public static function active($query)
{
$query->andWhere(['status' => 1]);
}
/**
* @return array the list of attributes for this record
*/
public function attributes()
{
return ['id', 'name', 'address', 'registration_date'];
}
/**
* @return ActiveQuery defines a relation to the Order record (can be in other database, e.g. elasticsearch or sql)
*/
public function getOrders()
{
return $this->hasMany(Order::className(), ['customer_id' => 'id']);
}
/**
* Defines a scope that modifies the `$query` to return only active(status = 1) customers
*/
public static function active($query)
{
$query->andWhere(['status' => 1]);
}
}
```
......
......@@ -7,17 +7,17 @@ To use this extension, simply add the following code in your application configu
```php
return [
//....
'components' => [
'view' => [
'renderers' => [
'tpl' => [
'class' => 'yii\smarty\ViewRenderer',
//'cachePath' => '@runtime/Smarty/cache',
],
],
],
],
//....
'components' => [
'view' => [
'renderers' => [
'tpl' => [
'class' => 'yii\smarty\ViewRenderer',
//'cachePath' => '@runtime/Smarty/cache',
],
],
],
],
];
```
......
......@@ -33,8 +33,8 @@ In order to setup Sphinx "searchd" to support MySQL protocol following configura
```
searchd
{
listen = localhost:9306:mysql41
...
listen = localhost:9306:mysql41
...
}
```
......@@ -46,15 +46,15 @@ To use this extension, simply add the following code in your application configu
```php
return [
//....
'components' => [
'sphinx' => [
'class' => 'yii\sphinx\Connection',
'dsn' => 'mysql:host=127.0.0.1;port=9306;',
'username' => '',
'password' => '',
],
],
//....
'components' => [
'sphinx' => [
'class' => 'yii\sphinx\Connection',
'dsn' => 'mysql:host=127.0.0.1;port=9306;',
'username' => '',
'password' => '',
],
],
];
```
......@@ -67,13 +67,13 @@ use yii\sphinx\ActiveRecord;
class Article extends ActiveRecord
{
/**
* @return string the name of the index associated with this ActiveRecord class.
*/
public static function indexName()
{
return 'idx_article';
}
/**
* @return string the name of the index associated with this ActiveRecord class.
*/
public static function indexName()
{
return 'idx_article';
}
}
```
......@@ -86,10 +86,10 @@ use yii\sphinx\Query;
$query = new Query;
$query->from('yii2_test_article_index')->match('development');
$provider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 10,
]
'query' => $query,
'pagination' => [
'pageSize' => 10,
]
]);
$models = $provider->getModels();
```
......@@ -99,10 +99,10 @@ use yii\data\ActiveDataProvider;
use app\models\Article;
$provider = new ActiveDataProvider([
'query' => Article::find(),
'pagination' => [
'pageSize' => 10,
]
'query' => Article::find(),
'pagination' => [
'pageSize' => 10,
]
]);
$models = $provider->getModels();
```
......@@ -7,12 +7,12 @@ To use this extension, simply add the following code in your application config
```php
return [
//....
'components' => [
'mail' => [
'class' => 'yii\swiftmailer\Mailer',
],
],
//....
'components' => [
'mail' => [
'class' => 'yii\swiftmailer\Mailer',
],
],
];
```
......
......@@ -88,7 +88,7 @@ html,body{
line-height: 1.25;
}
.header pre{
margin: 10px 0;
margin: 10px 0;
}
/* previous exceptions */
......@@ -134,8 +134,8 @@ html,body{
color: #aaa;
}
.header .previous pre{
font-size: 14px;
margin: 10px 0;
font-size: 14px;
margin: 10px 0;
}
/* call stack */
......@@ -355,9 +355,9 @@ html,body{
<?php endif; ?>
<h2><?= nl2br($handler->htmlEncode($exception->getMessage())) ?></h2>
<?php if ($exception instanceof \yii\db\Exception && !empty($exception->errorInfo)) {
echo '<pre>Error Info: ' . print_r($exception->errorInfo, true) . '</pre>';
} ?>
<?php if ($exception instanceof \yii\db\Exception && !empty($exception->errorInfo)) {
echo '<pre>Error Info: ' . print_r($exception->errorInfo, true) . '</pre>';
} ?>
<?= $handler->renderPreviousExceptions($exception) ?>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment