Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
6e538ac6
Commit
6e538ac6
authored
11 years ago
by
Panagiotis Moustafellos
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into cache-mset
parents
3ebbab02
6f526597
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
78 changed files
with
523 additions
and
405 deletions
+523
-405
main.php
apps/advanced/backend/views/layouts/main.php
+5
-5
error.php
apps/advanced/backend/views/site/error.php
+2
-2
login.php
apps/advanced/backend/views/site/login.php
+5
-5
main.php
apps/advanced/frontend/views/layouts/main.php
+5
-5
about.php
apps/advanced/frontend/views/site/about.php
+2
-2
contact.php
apps/advanced/frontend/views/site/contact.php
+6
-6
error.php
apps/advanced/frontend/views/site/error.php
+2
-2
login.php
apps/advanced/frontend/views/site/login.php
+5
-5
requestPasswordResetToken.php
...dvanced/frontend/views/site/requestPasswordResetToken.php
+3
-3
resetPassword.php
apps/advanced/frontend/views/site/resetPassword.php
+3
-3
signup.php
apps/advanced/frontend/views/site/signup.php
+5
-5
WebGuy.php
apps/basic/tests/acceptance/WebGuy.php
+6
-6
TestGuy.php
apps/basic/tests/functional/TestGuy.php
+4
-4
main.php
apps/basic/views/layouts/main.php
+5
-5
about.php
apps/basic/views/site/about.php
+2
-2
contact.php
apps/basic/views/site/contact.php
+6
-6
error.php
apps/basic/views/site/error.php
+2
-2
login.php
apps/basic/views/site/login.php
+4
-4
ActiveRecord.md
docs/api/db/ActiveRecord.md
+7
-8
active-record.md
docs/guide/active-record.md
+10
-10
i18n.md
docs/guide/i18n.md
+1
-1
installation.md
docs/guide/installation.md
+11
-40
upgrade-from-v1.md
docs/guide/upgrade-from-v1.md
+3
-3
url.md
docs/guide/url.md
+113
-0
view.md
docs/guide/view.md
+8
-8
Installer.php
extensions/composer/yii/composer/Installer.php
+4
-4
InstallerPlugin.php
extensions/composer/yii/composer/InstallerPlugin.php
+1
-1
composer.json
extensions/jui/composer.json
+1
-1
composer.json
extensions/mutex/composer.json
+1
-1
composer.json
extensions/smarty/composer.json
+2
-2
composer.json
extensions/twig/composer.json
+2
-2
BaseYii.php
framework/yii/BaseYii.php
+1
-2
Application.php
framework/yii/base/Application.php
+59
-11
Extension.php
framework/yii/base/Extension.php
+10
-0
Module.php
framework/yii/base/Module.php
+7
-13
View.php
framework/yii/base/View.php
+2
-2
ActiveRecord.php
framework/yii/db/ActiveRecord.php
+4
-22
index.php
framework/yii/debug/views/default/index.php
+5
-5
toolbar.php
framework/yii/debug/views/default/toolbar.php
+5
-5
view.php
framework/yii/debug/views/default/view.php
+2
-2
main.php
framework/yii/debug/views/layouts/main.php
+2
-2
controller.php
...rk/yii/gii/generators/controller/templates/controller.php
+4
-4
view.php
framework/yii/gii/generators/controller/templates/view.php
+3
-3
Generator.php
framework/yii/gii/generators/crud/Generator.php
+6
-6
controller.php
framework/yii/gii/generators/crud/templates/controller.php
+29
-29
search.php
framework/yii/gii/generators/crud/templates/search.php
+9
-9
_form.php
framework/yii/gii/generators/crud/templates/views/_form.php
+6
-6
_search.php
...ework/yii/gii/generators/crud/templates/views/_search.php
+8
-8
create.php
framework/yii/gii/generators/crud/templates/views/create.php
+6
-6
index.php
framework/yii/gii/generators/crud/templates/views/index.php
+12
-12
update.php
framework/yii/gii/generators/crud/templates/views/update.php
+7
-7
view.php
framework/yii/gii/generators/crud/templates/views/view.php
+9
-9
action.php
framework/yii/gii/generators/form/templates/action.php
+3
-3
form.php
framework/yii/gii/generators/form/templates/form.php
+8
-8
model.php
framework/yii/gii/generators/model/templates/model.php
+10
-10
controller.php
framework/yii/gii/generators/module/templates/controller.php
+1
-1
module.php
framework/yii/gii/generators/module/templates/module.php
+3
-3
view.php
framework/yii/gii/generators/module/templates/view.php
+6
-6
diff.php
framework/yii/gii/views/default/diff.php
+1
-1
index.php
framework/yii/gii/views/default/index.php
+3
-3
view.php
framework/yii/gii/views/default/view.php
+4
-4
files.php
framework/yii/gii/views/default/view/files.php
+3
-3
results.php
framework/yii/gii/views/default/view/results.php
+1
-1
generator.php
framework/yii/gii/views/layouts/generator.php
+1
-1
main.php
framework/yii/gii/views/layouts/main.php
+3
-3
index.php
framework/yii/requirements/views/web/index.php
+6
-6
callStackItem.php
framework/yii/views/errorHandler/callStackItem.php
+4
-4
error.php
framework/yii/views/errorHandler/error.php
+4
-4
exception.php
framework/yii/views/errorHandler/exception.php
+0
-0
previousException.php
framework/yii/views/errorHandler/previousException.php
+6
-6
migration.php
framework/yii/views/migration.php
+2
-2
AssetBundle.php
framework/yii/web/AssetBundle.php
+7
-8
AssetManager.php
framework/yii/web/AssetManager.php
+7
-3
User.php
framework/yii/web/User.php
+0
-1
Customer.php
tests/unit/data/ar/Customer.php
+1
-1
Order.php
tests/unit/data/ar/Order.php
+4
-4
OrderItem.php
tests/unit/data/ar/OrderItem.php
+2
-2
layout.php
tests/unit/data/views/layout.php
+1
-1
No files found.
apps/advanced/backend/views/layouts/main.php
View file @
6e538ac6
...
...
@@ -15,8 +15,8 @@ AppAsset::register($this);
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"
<?=
Yii
::
$app
->
charset
;
?>
"
/>
<title>
<?=
Html
::
encode
(
$this
->
title
);
?>
</title>
<meta
charset=
"
<?=
Yii
::
$app
->
charset
?>
"
/>
<title>
<?=
Html
::
encode
(
$this
->
title
)
?>
</title>
<?php
$this
->
head
();
?>
</head>
<body>
...
...
@@ -48,13 +48,13 @@ AppAsset::register($this);
<?=
Breadcrumbs
::
widget
([
'links'
=>
isset
(
$this
->
params
[
'breadcrumbs'
])
?
$this
->
params
[
'breadcrumbs'
]
:
[],
]);
?>
<?=
$content
;
?>
<?=
$content
?>
</div>
<footer
class=
"footer"
>
<div
class=
"container"
>
<p
class=
"pull-left"
>
©
My Company
<?=
date
(
'Y'
);
?>
</p>
<p
class=
"pull-right"
>
<?=
Yii
::
powered
();
?>
</p>
<p
class=
"pull-left"
>
©
My Company
<?=
date
(
'Y'
)
?>
</p>
<p
class=
"pull-right"
>
<?=
Yii
::
powered
()
?>
</p>
</div>
</footer>
...
...
This diff is collapsed.
Click to expand it.
apps/advanced/backend/views/site/error.php
View file @
6e538ac6
...
...
@@ -13,10 +13,10 @@ $this->title = $name;
?>
<div
class=
"site-error"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<div
class=
"alert alert-danger"
>
<?=
nl2br
(
Html
::
encode
(
$message
));
?>
<?=
nl2br
(
Html
::
encode
(
$message
))
?>
</div>
<p>
...
...
This diff is collapsed.
Click to expand it.
apps/advanced/backend/views/site/login.php
View file @
6e538ac6
...
...
@@ -11,18 +11,18 @@ $this->title = 'Login';
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"site-login"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
Please fill out the following fields to login:
</p>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'login-form'
]);
?>
<?=
$form
->
field
(
$model
,
'username'
);
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<?=
$form
->
field
(
$model
,
'rememberMe'
)
->
checkbox
();
?>
<?=
$form
->
field
(
$model
,
'username'
)
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
()
?>
<?=
$form
->
field
(
$model
,
'rememberMe'
)
->
checkbox
()
?>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
'Login'
,
[
'class'
=>
'btn btn-primary'
]);
?>
<?=
Html
::
submitButton
(
'Login'
,
[
'class'
=>
'btn btn-primary'
])
?>
</div>
<?php
ActiveForm
::
end
();
?>
</div>
...
...
This diff is collapsed.
Click to expand it.
apps/advanced/frontend/views/layouts/main.php
View file @
6e538ac6
...
...
@@ -16,8 +16,8 @@ AppAsset::register($this);
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"
<?=
Yii
::
$app
->
charset
;
?>
"
/>
<title>
<?=
Html
::
encode
(
$this
->
title
);
?>
</title>
<meta
charset=
"
<?=
Yii
::
$app
->
charset
?>
"
/>
<title>
<?=
Html
::
encode
(
$this
->
title
)
?>
</title>
<?php
$this
->
head
();
?>
</head>
<body>
...
...
@@ -53,13 +53,13 @@ AppAsset::register($this);
'links'
=>
isset
(
$this
->
params
[
'breadcrumbs'
])
?
$this
->
params
[
'breadcrumbs'
]
:
[],
]);
?>
<?=
Alert
::
widget
()
?>
<?=
$content
;
?>
<?=
$content
?>
</div>
<footer
class=
"footer"
>
<div
class=
"container"
>
<p
class=
"pull-left"
>
©
My Company
<?=
date
(
'Y'
);
?>
</p>
<p
class=
"pull-right"
>
<?=
Yii
::
powered
();
?>
</p>
<p
class=
"pull-left"
>
©
My Company
<?=
date
(
'Y'
)
?>
</p>
<p
class=
"pull-right"
>
<?=
Yii
::
powered
()
?>
</p>
</div>
</footer>
...
...
This diff is collapsed.
Click to expand it.
apps/advanced/frontend/views/site/about.php
View file @
6e538ac6
...
...
@@ -8,9 +8,9 @@ $this->title = 'About';
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"site-about"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
This is the About page. You may modify the following file to customize its content:
</p>
<code>
<?=
__FILE__
;
?>
</code>
<code>
<?=
__FILE__
?>
</code>
</div>
This diff is collapsed.
Click to expand it.
apps/advanced/frontend/views/site/contact.php
View file @
6e538ac6
...
...
@@ -12,7 +12,7 @@ $this->title = 'Contact';
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"site-contact"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
...
...
@@ -21,16 +21,16 @@ $this->params['breadcrumbs'][] = $this->title;
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'contact-form'
]);
?>
<?=
$form
->
field
(
$model
,
'name'
);
?>
<?=
$form
->
field
(
$model
,
'email'
);
?>
<?=
$form
->
field
(
$model
,
'subject'
);
?>
<?=
$form
->
field
(
$model
,
'body'
)
->
textArea
([
'rows'
=>
6
]);
?>
<?=
$form
->
field
(
$model
,
'name'
)
?>
<?=
$form
->
field
(
$model
,
'email'
)
?>
<?=
$form
->
field
(
$model
,
'subject'
)
?>
<?=
$form
->
field
(
$model
,
'body'
)
->
textArea
([
'rows'
=>
6
])
?>
<?=
$form
->
field
(
$model
,
'verifyCode'
)
->
widget
(
Captcha
::
className
(),
[
'options'
=>
[
'class'
=>
'form-control'
],
'template'
=>
'<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>'
,
]);
?>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
'Submit'
,
[
'class'
=>
'btn btn-primary'
]);
?>
<?=
Html
::
submitButton
(
'Submit'
,
[
'class'
=>
'btn btn-primary'
])
?>
</div>
<?php
ActiveForm
::
end
();
?>
</div>
...
...
This diff is collapsed.
Click to expand it.
apps/advanced/frontend/views/site/error.php
View file @
6e538ac6
...
...
@@ -13,10 +13,10 @@ $this->title = $name;
?>
<div
class=
"site-error"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<div
class=
"alert alert-danger"
>
<?=
nl2br
(
Html
::
encode
(
$message
));
?>
<?=
nl2br
(
Html
::
encode
(
$message
))
?>
</div>
<p>
...
...
This diff is collapsed.
Click to expand it.
apps/advanced/frontend/views/site/login.php
View file @
6e538ac6
...
...
@@ -11,21 +11,21 @@ $this->title = 'Login';
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"site-login"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
Please fill out the following fields to login:
</p>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'login-form'
]);
?>
<?=
$form
->
field
(
$model
,
'username'
);
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<?=
$form
->
field
(
$model
,
'rememberMe'
)
->
checkbox
();
?>
<?=
$form
->
field
(
$model
,
'username'
)
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
()
?>
<?=
$form
->
field
(
$model
,
'rememberMe'
)
->
checkbox
()
?>
<div
style=
"color:#999;margin:1em 0"
>
If you forgot your password you can
<?=
Html
::
a
(
'reset it'
,
[
'site/request-password-reset'
])
?>
.
</div>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
'Login'
,
[
'class'
=>
'btn btn-primary'
]);
?>
<?=
Html
::
submitButton
(
'Login'
,
[
'class'
=>
'btn btn-primary'
])
?>
</div>
<?php
ActiveForm
::
end
();
?>
</div>
...
...
This diff is collapsed.
Click to expand it.
apps/advanced/frontend/views/site/requestPasswordResetToken.php
View file @
6e538ac6
...
...
@@ -11,16 +11,16 @@ $this->title = 'Request password reset';
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"site-request-password-reset"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
Please fill out your email. A link to reset password will be sent there.
</p>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'request-password-reset-form'
]);
?>
<?=
$form
->
field
(
$model
,
'email'
);
?>
<?=
$form
->
field
(
$model
,
'email'
)
?>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
'Send'
,
[
'class'
=>
'btn btn-primary'
]);
?>
<?=
Html
::
submitButton
(
'Send'
,
[
'class'
=>
'btn btn-primary'
])
?>
</div>
<?php
ActiveForm
::
end
();
?>
</div>
...
...
This diff is collapsed.
Click to expand it.
apps/advanced/frontend/views/site/resetPassword.php
View file @
6e538ac6
...
...
@@ -11,16 +11,16 @@ $this->title = 'Reset password';
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"site-reset-password"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
Please choose your new password:
</p>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'reset-password-form'
]);
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
()
?>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
'Save'
,
[
'class'
=>
'btn btn-primary'
]);
?>
<?=
Html
::
submitButton
(
'Save'
,
[
'class'
=>
'btn btn-primary'
])
?>
</div>
<?php
ActiveForm
::
end
();
?>
</div>
...
...
This diff is collapsed.
Click to expand it.
apps/advanced/frontend/views/site/signup.php
View file @
6e538ac6
...
...
@@ -11,18 +11,18 @@ $this->title = 'Signup';
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"site-signup"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
Please fill out the following fields to signup:
</p>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'form-signup'
]);
?>
<?=
$form
->
field
(
$model
,
'username'
);
?>
<?=
$form
->
field
(
$model
,
'email'
);
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<?=
$form
->
field
(
$model
,
'username'
)
?>
<?=
$form
->
field
(
$model
,
'email'
)
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
()
?>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
'Signup'
,
[
'class'
=>
'btn btn-primary'
]);
?>
<?=
Html
::
submitButton
(
'Signup'
,
[
'class'
=>
'btn btn-primary'
])
?>
</div>
<?php
ActiveForm
::
end
();
?>
</div>
...
...
This diff is collapsed.
Click to expand it.
apps/basic/tests/acceptance/WebGuy.php
View file @
6e538ac6
...
...
@@ -36,7 +36,7 @@ class WebGuy extends \Codeception\AbstractGuy
*
* ``` php
* <?php
* $I->submitForm('#login',
array('login' => 'davert', 'password' => '123456')
);
* $I->submitForm('#login',
['login' => 'davert', 'password' => '123456']
);
*
* ```
*
...
...
@@ -55,7 +55,7 @@ class WebGuy extends \Codeception\AbstractGuy
*
* ``` php
* <?php
* $I->submitForm('#userForm',
array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true))
);
* $I->submitForm('#userForm',
['user' => ['login' => 'Davert', 'password' => '123456', 'agree' => true]]
);
*
* ```
* Note, that pricing plan will be set to Paid, as it's selected on page.
...
...
@@ -89,8 +89,8 @@ class WebGuy extends \Codeception\AbstractGuy
*
* ``` php
* <?php
* $I->sendAjaxPostRequest('/updateSettings',
array('notifications' => true)
; // POST
* $I->sendAjaxGetRequest('/updateSettings',
array('notifications' => true)
; // GET
* $I->sendAjaxPostRequest('/updateSettings',
['notifications' => true]
; // POST
* $I->sendAjaxGetRequest('/updateSettings',
['notifications' => true]
; // GET
*
* ```
*
...
...
@@ -202,12 +202,12 @@ class WebGuy extends \Codeception\AbstractGuy
* // from the official Guzzle manual
* $I->amGoingTo('Sign all requests with OAuth');
* $I->executeInGuzzle(function (\Guzzle\Http\Client $client) {
* $client->addSubscriber(new Guzzle\Plugin\Oauth\OauthPlugin(
array(
* $client->addSubscriber(new Guzzle\Plugin\Oauth\OauthPlugin(
[
* 'consumer_key' => '***',
* 'consumer_secret' => '***',
* 'token' => '***',
* 'token_secret' => '***'
*
)
));
*
]
));
* });
* ?>
* ```
...
...
This diff is collapsed.
Click to expand it.
apps/basic/tests/functional/TestGuy.php
View file @
6e538ac6
...
...
@@ -832,7 +832,7 @@ class TestGuy extends \Codeception\AbstractGuy
*
* ``` php
* <?php
* $I->submitForm('#login',
array('login' => 'davert', 'password' => '123456')
);
* $I->submitForm('#login',
['login' => 'davert', 'password' => '123456']
);
*
* ```
*
...
...
@@ -851,7 +851,7 @@ class TestGuy extends \Codeception\AbstractGuy
*
* ``` php
* <?php
* $I->submitForm('#userForm',
array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true))
);
* $I->submitForm('#userForm',
['user' => ['login' => 'Davert', 'password' => '123456', 'agree' => true]]
);
*
* ```
* Note, that pricing plan will be set to Paid, as it's selected on page.
...
...
@@ -1042,8 +1042,8 @@ class TestGuy extends \Codeception\AbstractGuy
*
* ``` php
* <?php
* $I->sendAjaxPostRequest('/updateSettings',
array('notifications' => true)
; // POST
* $I->sendAjaxGetRequest('/updateSettings',
array('notifications' => true)
; // GET
* $I->sendAjaxPostRequest('/updateSettings',
['notifications' => true]
; // POST
* $I->sendAjaxGetRequest('/updateSettings',
['notifications' => true]
; // GET
*
* ```
*
...
...
This diff is collapsed.
Click to expand it.
apps/basic/views/layouts/main.php
View file @
6e538ac6
...
...
@@ -14,8 +14,8 @@ app\config\AppAsset::register($this);
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"
<?=
Yii
::
$app
->
charset
;
?>
"
/>
<title>
<?=
Html
::
encode
(
$this
->
title
);
?>
</title>
<meta
charset=
"
<?=
Yii
::
$app
->
charset
?>
"
/>
<title>
<?=
Html
::
encode
(
$this
->
title
)
?>
</title>
<?php
$this
->
head
();
?>
</head>
<body>
...
...
@@ -48,13 +48,13 @@ app\config\AppAsset::register($this);
<?=
Breadcrumbs
::
widget
([
'links'
=>
isset
(
$this
->
params
[
'breadcrumbs'
])
?
$this
->
params
[
'breadcrumbs'
]
:
[],
]);
?>
<?=
$content
;
?>
<?=
$content
?>
</div>
<footer
class=
"footer"
>
<div
class=
"container"
>
<p
class=
"pull-left"
>
©
My Company
<?=
date
(
'Y'
);
?>
</p>
<p
class=
"pull-right"
>
<?=
Yii
::
powered
();
?>
</p>
<p
class=
"pull-left"
>
©
My Company
<?=
date
(
'Y'
)
?>
</p>
<p
class=
"pull-right"
>
<?=
Yii
::
powered
()
?>
</p>
</div>
</footer>
...
...
This diff is collapsed.
Click to expand it.
apps/basic/views/site/about.php
View file @
6e538ac6
...
...
@@ -8,11 +8,11 @@ $this->title = 'About';
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"site-about"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
This is the About page. You may modify the following file to customize its content:
</p>
<code>
<?=
__FILE__
;
?>
</code>
<code>
<?=
__FILE__
?>
</code>
</div>
This diff is collapsed.
Click to expand it.
apps/basic/views/site/contact.php
View file @
6e538ac6
...
...
@@ -12,7 +12,7 @@ $this->title = 'Contact';
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"site-contact"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<?php
if
(
Yii
::
$app
->
session
->
hasFlash
(
'contactFormSubmitted'
))
:
?>
...
...
@@ -29,16 +29,16 @@ $this->params['breadcrumbs'][] = $this->title;
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'contact-form'
]);
?>
<?=
$form
->
field
(
$model
,
'name'
);
?>
<?=
$form
->
field
(
$model
,
'email'
);
?>
<?=
$form
->
field
(
$model
,
'subject'
);
?>
<?=
$form
->
field
(
$model
,
'body'
)
->
textArea
([
'rows'
=>
6
]);
?>
<?=
$form
->
field
(
$model
,
'name'
)
?>
<?=
$form
->
field
(
$model
,
'email'
)
?>
<?=
$form
->
field
(
$model
,
'subject'
)
?>
<?=
$form
->
field
(
$model
,
'body'
)
->
textArea
([
'rows'
=>
6
])
?>
<?=
$form
->
field
(
$model
,
'verifyCode'
)
->
widget
(
Captcha
::
className
(),
[
'options'
=>
[
'class'
=>
'form-control'
],
'template'
=>
'<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>'
,
]);
?>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
'Submit'
,
[
'class'
=>
'btn btn-primary'
]);
?>
<?=
Html
::
submitButton
(
'Submit'
,
[
'class'
=>
'btn btn-primary'
])
?>
</div>
<?php
ActiveForm
::
end
();
?>
</div>
...
...
This diff is collapsed.
Click to expand it.
apps/basic/views/site/error.php
View file @
6e538ac6
...
...
@@ -13,10 +13,10 @@ $this->title = $name;
?>
<div
class=
"site-error"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<div
class=
"alert alert-danger"
>
<?=
nl2br
(
Html
::
encode
(
$message
));
?>
<?=
nl2br
(
Html
::
encode
(
$message
))
?>
</div>
<p>
...
...
This diff is collapsed.
Click to expand it.
apps/basic/views/site/login.php
View file @
6e538ac6
...
...
@@ -11,7 +11,7 @@ $this->title = 'Login';
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"site-login"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
Please fill out the following fields to login:
</p>
...
...
@@ -24,9 +24,9 @@ $this->params['breadcrumbs'][] = $this->title;
],
]);
?>
<?=
$form
->
field
(
$model
,
'username'
);
?>
<?=
$form
->
field
(
$model
,
'username'
)
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
()
?>
<?=
$form
->
field
(
$model
,
'rememberMe'
,
[
'template'
=>
"<div class=
\"
col-lg-offset-1 col-lg-3
\"
>
{
input
}
</div>
\n
<div class=
\"
col-lg-8
\"
>
{
error
}
</div>"
,
...
...
@@ -34,7 +34,7 @@ $this->params['breadcrumbs'][] = $this->title;
<div
class=
"form-group"
>
<div
class=
"col-lg-offset-1 col-lg-11"
>
<?=
Html
::
submitButton
(
'Login'
,
[
'class'
=>
'btn btn-primary'
]);
?>
<?=
Html
::
submitButton
(
'Login'
,
[
'class'
=>
'btn btn-primary'
])
?>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
docs/api/db/ActiveRecord.md
View file @
6e538ac6
...
...
@@ -175,7 +175,7 @@ class Customer extends \yii\db\ActiveRecord
{
public function getOrders()
{
return $this->hasMany(
'Order'
, ['customer_id' => 'id']);
return $this->hasMany(
Order::className()
, ['customer_id' => 'id']);
}
}
...
...
@@ -183,7 +183,7 @@ class Order extends \yii\db\ActiveRecord
{
public function getCustomer()
{
return $this->hasOne(
'Customer'
, ['id' => 'customer_id']);
return $this->hasOne(
Customer::className()
, ['id' => 'customer_id']);
}
}
~~~
...
...
@@ -194,8 +194,7 @@ a one-many relationship. For example, a customer has many orders. And the [[hasO
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 related models should use. If specified without
a namespace, the namespace will be taken from the declaring class.
-
`$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.
...
...
@@ -223,7 +222,7 @@ class Customer extends \yii\db\ActiveRecord
{
public function getBigOrders($threshold = 100)
{
return $this->hasMany(
'Order'
, ['customer_id' => 'id'])
return $this->hasMany(
Order::className()
, ['customer_id' => 'id'])
->where('subtotal > :threshold', [':threshold' => $threshold])
->orderBy('id');
}
...
...
@@ -244,7 +243,7 @@ class Order extends \yii\db\ActiveRecord
{
public function getItems()
{
return $this->hasMany(
'Item'
, ['id' => 'item_id'])
return $this->hasMany(
Item::className()
, ['id' => 'item_id'])
->viaTable('tbl_order_item', ['order_id' => 'id']);
}
}
...
...
@@ -259,12 +258,12 @@ class Order extends \yii\db\ActiveRecord
{
public function getOrderItems()
{
return $this->hasMany(
'OrderItem'
, ['order_id' => 'id']);
return $this->hasMany(
OrderItem::className()
, ['order_id' => 'id']);
}
public function getItems()
{
return $this->hasMany(
'Item'
, ['id' => 'item_id'])
return $this->hasMany(
Item::className()
, ['id' => 'item_id'])
->via('orderItems');
}
}
...
...
This diff is collapsed.
Click to expand it.
docs/guide/active-record.md
View file @
6e538ac6
...
...
@@ -202,7 +202,7 @@ class Customer extends \yii\db\ActiveRecord
{
public
function
getOrders
()
{
return
$this
->
hasMany
(
'Order'
,
[
'customer_id'
=>
'id'
]);
return
$this
->
hasMany
(
Order
::
className
()
,
[
'customer_id'
=>
'id'
]);
}
}
...
...
@@ -210,7 +210,7 @@ class Order extends \yii\db\ActiveRecord
{
public
function
getCustomer
()
{
return
$this
->
hasOne
(
'Customer'
,
[
'id'
=>
'customer_id'
]);
return
$this
->
hasOne
(
Customer
::
className
()
,
[
'id'
=>
'customer_id'
]);
}
}
```
...
...
@@ -257,7 +257,7 @@ class Customer extends \yii\db\ActiveRecord
{
public
function
getBigOrders
(
$threshold
=
100
)
{
return
$this
->
hasMany
(
'Order'
,
[
'customer_id'
=>
'id'
])
return
$this
->
hasMany
(
Order
::
className
()
,
[
'customer_id'
=>
'id'
])
->
where
(
'subtotal > :threshold'
,
[
':threshold'
=>
$threshold
])
->
orderBy
(
'id'
);
}
...
...
@@ -291,7 +291,7 @@ class Order extends \yii\db\ActiveRecord
{
public
function
getItems
()
{
return
$this
->
hasMany
(
'Item'
,
[
'id'
=>
'item_id'
])
return
$this
->
hasMany
(
Item
::
className
()
,
[
'id'
=>
'item_id'
])
->
viaTable
(
'tbl_order_item'
,
[
'order_id'
=>
'id'
]);
}
}
...
...
@@ -306,12 +306,12 @@ class Order extends \yii\db\ActiveRecord
{
public
function
getOrderItems
()
{
return
$this
->
hasMany
(
'OrderItem'
,
[
'order_id'
=>
'id'
]);
return
$this
->
hasMany
(
OrderItem
::
className
()
,
[
'order_id'
=>
'id'
]);
}
public
function
getItems
()
{
return
$this
->
hasMany
(
'Item'
,
[
'id'
=>
'item_id'
])
return
$this
->
hasMany
(
Item
::
className
()
,
[
'id'
=>
'item_id'
])
->
via
(
'orderItems'
);
}
}
...
...
@@ -517,7 +517,7 @@ class Feature extends \yii\db\ActiveRecord
public
function
getProduct
()
{
return
$this
->
hasOne
(
'Product'
,
[
'product_id'
=>
'id'
]);
return
$this
->
hasOne
(
Product
::
className
()
,
[
'product_id'
=>
'id'
]);
}
}
...
...
@@ -527,7 +527,7 @@ class Product extends \yii\db\ActiveRecord
public
function
getFeatures
()
{
return
$this
->
hasMany
(
'Feature'
,
[
'id'
=>
'product_id'
]);
return
$this
->
hasMany
(
Feature
::
className
()
,
[
'id'
=>
'product_id'
]);
}
}
```
...
...
@@ -566,7 +566,7 @@ class Feature extends \yii\db\ActiveRecord
public
function
getProduct
()
{
return
$this
->
hasOne
(
'Product'
,
[
'product_id'
=>
'id'
]);
return
$this
->
hasOne
(
Product
::
className
()
,
[
'product_id'
=>
'id'
]);
}
public
function
scenarios
()
...
...
@@ -586,7 +586,7 @@ class Product extends \yii\db\ActiveRecord
public
function
getFeatures
()
{
return
$this
->
hasMany
(
'Feature'
,
[
'id'
=>
'product_id'
]);
return
$this
->
hasMany
(
Feature
::
className
()
,
[
'id'
=>
'product_id'
]);
}
public
function
scenarios
()
...
...
This diff is collapsed.
Click to expand it.
docs/guide/i18n.md
View file @
6e538ac6
...
...
@@ -205,7 +205,7 @@ Will produce "You are 42nd visitor here!".
```php
echo \Yii::t('app', 'You are here for {n, duration} already!', ['n' => 4
2
]);
echo \Yii::t('app', 'You are here for {n, duration} already!', ['n' => 4
7
]);
```
Will produce "You are here for 47 sec. already!".
...
...
This diff is collapsed.
Click to expand it.
docs/guide/installation.md
View file @
6e538ac6
...
...
@@ -83,57 +83,28 @@ Yii to catch all requests to nonexistent files, which allows us to have nice-loo
~~~
server {
set $host_path "/www/mysite";
access_log /www/mysite/log/access.log main;
server_name mysite;
root $host_path/htdocs;
set $yii_bootstrap "index.php";
charset utf-8;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
}
listen 80;
server_name mysite.local;
root /path/to/project/webroot/directory
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
access_log /path/to/project/log/access.log main;
#avoid processing of calls to unexisting static files by yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
location / {
try_files $uri $uri/ /index.php?$args; # Redirect everything that isn't real file to index.php including arguments.
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
#let yii catch the calls to unexising PHP files
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
#for php-cgi
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
#for php-fpm
#fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
#PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
location ~ /\.
ht
{
deny
all;
location ~ /\.
(ht|svn|git)
{
deny all;
}
}
~~~
Using this configuration you can set
`cgi.fix_pathinfo=0`
in php.ini to avoid
many unnecessary system
`stat()`
calls.
Make sure to set
`cgi.fix_pathinfo=0`
in php.ini to avoid many unnecessary system
`stat()`
calls.
This diff is collapsed.
Click to expand it.
docs/guide/upgrade-from-v1.md
View file @
6e538ac6
...
...
@@ -340,10 +340,10 @@ It is represented as an `ActiveField` object. Using fields, you can build a form
```
php
<?php
$form
=
yii\widgets\ActiveForm
::
begin
();
?>
<?=
$form
->
field
(
$model
,
'username'
);
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<?=
$form
->
field
(
$model
,
'username'
)
?>
<?=
$form
->
field
(
$model
,
'password'
)
->
passwordInput
()
?>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
'Login'
);
?>
<?=
Html
::
submitButton
(
'Login'
)
?>
</div>
<?php
yii\widgets\ActiveForm
::
end
();
?>
```
...
...
This diff is collapsed.
Click to expand it.
docs/guide/url.md
View file @
6e538ac6
URL Management
==============
The concept of URL management in Yii fairly simple. The idea is that application uses internal routes and parameters
everywhere. Framework takes care of translating routes into URLs and back according to URL manager configuration.
This approach allows you to adjust URLs in a single config file without touching application code.
Internal route
--------------
Internal routes and parameters are what you're dealing with when implementing an application using Yii.
Each controller and its action has a corresponding internal route such as
`site/index`
. Here
`site`
is referred to as
controller ID while
`index`
is referred to as action ID. If controller belongs to a module, internal route is prefixed
with the module ID such as
`blog/post/index`
for a blog module.
Creating URLs
-------------
As was already mentioned, the most important rule is to always use URL manager to create URLs. Url manages is an
application component with
`urlManager`
id that is accessible both from web and console applications via
`\Yii::$app->urlManager`
and has two following URL creation methods available:
-
createUrl($route, $params =
[
])
-
createAbsoluteUrl($route, $params =
[
])
First one creates URL relative to the application root while the second one creates URL prefixed with protocol and
hostname. The former is suitable for internal application URLs while the latter is used when you need to create rules
for outside the website. For example, when sending emails or generating RSS feed.
Some examples:
```
php
echo
\Yii
::
$app
->
urlManager
->
createUrl
(
'site/page'
,
[
'id'
=>
'about'
]);
echo
\Yii
::
$app
->
urlManager
->
createAbsoluteUrl
(
'blog/post/index'
);
```
Inside web application controller you can use its own
`createUrl`
shortcut method in the following forms:
```
php
echo
$this
->
createUrl
(
''
);
// currently active route
echo
$this
->
createUrl
(
'view'
,
[
'id'
=>
'contact'
]);
// same controller, different action
echo
$this
->
createUrl
(
'post/index'
);
// same module, different controller and action
echo
$this
->
createUrl
(
'/site/index'
);
// absolute route no matter which controller we're in
```
> **Tip**: In order to generate URL with a hashtag, for example `/index.php?r=site/page&id=100#title`, you need to
specify parameter named
`#`
using
`$this->createUrl('post/read', ['id' => 100, '#' => 'title'])`
.
Customizing URLs
----------------
By default Yii uses a query string format URLs such as
`/index.php?r=news/view&id=100`
. In order to make URLs
human-friendly you need to configure
`urlManager`
component like the following:
```
php
<?php
return
[
// ...
'components'
=>
[
'urlManager'
=>
[
'enablePrettyUrl'
=>
true
,
'showScriptName'
=>
false
,
],
],
];
```
Note that
### Named parameters
### Handling subdomains
### Faking URL Suffix
```
php
<?php
return
[
// ...
'components'
=>
[
'urlManager'
=>
[
'suffix'
=>
'.html'
,
],
],
];
```
### Handling REST
URL parsing
-----------
Complimentary to creating URLs Yii is handling transforming custom URLs back into internal route and parameters.
### Strict URL parsing
By default if there's no custom rule for URL and URL matches default format such as
`/site/page`
Yii tries to run a
corresponding controller's action. This behavior could be disabled so if there's no custom rule match, a 404 not found
error will be produced immediately.
```
php
<?php
return
[
// ...
'components'
=>
[
'urlManager'
=>
[
'enableStrictParsing'
=>
true
,
],
],
];
```
Creating your own rule classes
------------------------------
This diff is collapsed.
Click to expand it.
docs/guide/view.md
View file @
6e538ac6
...
...
@@ -76,7 +76,7 @@ use yii\helpers\Html;
?>
<div
class=
"username"
>
<?=
Html
::
encode
(
$user
->
name
);
?>
<?=
Html
::
encode
(
$user
->
name
)
?>
</div>
```
...
...
@@ -97,7 +97,7 @@ use yii\helpers\HtmlPurifier;
?>
<div
class=
"post"
>
<?=
HtmlPurifier
::
process
(
$post
->
text
);
?>
<?=
HtmlPurifier
::
process
(
$post
->
text
)
?>
</div>
```
...
...
@@ -256,16 +256,16 @@ use yii\helpers\Html;
?>
<?php
$this
->
beginPage
();
?>
<!DOCTYPE html>
<html
lang=
"
<?=
Yii
::
$app
->
charset
;
?>
"
>
<html
lang=
"
<?=
Yii
::
$app
->
charset
?>
"
>
<head>
<meta
charset=
"
<?=
Yii
::
$app
->
charset
;
?>
"
/>
<title>
<?=
Html
::
encode
(
$this
->
title
);
?>
</title>
<meta
charset=
"
<?=
Yii
::
$app
->
charset
?>
"
/>
<title>
<?=
Html
::
encode
(
$this
->
title
)
?>
</title>
<?php
$this
->
head
();
?>
</head>
<body>
<?php
$this
->
beginBody
();
?>
<div
class=
"container"
>
<?=
$content
;
?>
<?=
$content
?>
</div>
<footer
class=
"footer"
>
© 2013 me :)
</footer>
<?php
$this
->
endBody
();
?>
...
...
@@ -295,8 +295,8 @@ use yii\helpers\Html;
?>
<div
class=
"profile"
>
<h2>
<?=
Html
::
encode
(
$username
);
?>
</h2>
<p>
<?=
Html
::
encode
(
$tagline
);
?>
</p>
<h2>
<?=
Html
::
encode
(
$username
)
?>
</h2>
<p>
<?=
Html
::
encode
(
$tagline
)
?>
</p>
</div>
```
...
...
This diff is collapsed.
Click to expand it.
extensions/composer/yii/composer/Installer.php
View file @
6e538ac6
...
...
@@ -31,7 +31,7 @@ class Installer extends LibraryInstaller
*/
public
function
supports
(
$packageType
)
{
return
$packageType
===
'yii-extension'
;
return
$packageType
===
'yii
2
-extension'
;
}
/**
...
...
@@ -65,7 +65,7 @@ class Installer extends LibraryInstaller
protected
function
addPackage
(
PackageInterface
$package
)
{
$extension
=
[
'name'
=>
$package
->
get
Pretty
Name
(),
'name'
=>
$package
->
getName
(),
'version'
=>
$package
->
getVersion
(),
];
...
...
@@ -76,14 +76,14 @@ class Installer extends LibraryInstaller
}
$extensions
=
$this
->
loadExtensions
();
$extensions
[
$package
->
get
Unique
Name
()]
=
$extension
;
$extensions
[
$package
->
getName
()]
=
$extension
;
$this
->
saveExtensions
(
$extensions
);
}
protected
function
removePackage
(
PackageInterface
$package
)
{
$packages
=
$this
->
loadExtensions
();
unset
(
$packages
[
$package
->
get
Unique
Name
()]);
unset
(
$packages
[
$package
->
getName
()]);
$this
->
saveExtensions
(
$packages
);
}
...
...
This diff is collapsed.
Click to expand it.
extensions/composer/yii/composer/InstallerPlugin.php
View file @
6e538ac6
...
...
@@ -28,7 +28,7 @@ class InstallerPlugin implements PluginInterface
$composer
->
getInstallationManager
()
->
addInstaller
(
$installer
);
$file
=
rtrim
(
$composer
->
getConfig
()
->
get
(
'vendor-dir'
),
'/'
)
.
'/yii-extensions.php'
;
if
(
!
is_file
(
$file
))
{
file_put_contents
(
$file
,
"<?php
\n
return
array()
;
\n
"
);
file_put_contents
(
$file
,
"<?php
\n
return
[]
;
\n
"
);
}
}
}
This diff is collapsed.
Click to expand it.
extensions/jui/composer.json
View file @
6e538ac6
...
...
@@ -2,7 +2,7 @@
"name"
:
"yiisoft/yii2-jui"
,
"description"
:
"The Jquery UI extension for the Yii framework"
,
"keywords"
:
[
"yii"
,
"Jquery UI"
,
"renderer"
],
"type"
:
"yii-extension"
,
"type"
:
"yii
2
-extension"
,
"license"
:
"BSD-3-Clause"
,
"support"
:
{
"issues"
:
"https://github.com/yiisoft/yii2/issues?state=open"
,
...
...
This diff is collapsed.
Click to expand it.
extensions/mutex/composer.json
View file @
6e538ac6
...
...
@@ -2,7 +2,7 @@
"name"
:
"yiisoft/yii2-mutex"
,
"description"
:
"Mutual exclusion extension for the Yii framework"
,
"keywords"
:
[
"yii"
,
"mutex"
],
"type"
:
"yii-extension"
,
"type"
:
"yii
2
-extension"
,
"license"
:
"BSD-3-Clause"
,
"support"
:
{
"issues"
:
"https://github.com/yiisoft/yii2/issues?state=open"
,
...
...
This diff is collapsed.
Click to expand it.
extensions/smarty/composer.json
View file @
6e538ac6
...
...
@@ -2,7 +2,7 @@
"name"
:
"yiisoft/yii2-smarty"
,
"description"
:
"The Smarty integration for the Yii framework"
,
"keywords"
:
[
"yii"
,
"smarty"
,
"renderer"
],
"type"
:
"yii-extension"
,
"type"
:
"yii
2
-extension"
,
"license"
:
"BSD-3-Clause"
,
"support"
:
{
"issues"
:
"https://github.com/yiisoft/yii2/issues?state=open"
,
...
...
@@ -13,7 +13,7 @@
},
"authors"
:
[
{
"name"
:
"Ale
nxa
der Makarov"
,
"name"
:
"Ale
xan
der Makarov"
,
"email"
:
"sam@rmcreative.ru"
}
],
...
...
This diff is collapsed.
Click to expand it.
extensions/twig/composer.json
View file @
6e538ac6
...
...
@@ -2,7 +2,7 @@
"name"
:
"yiisoft/yii2-twig"
,
"description"
:
"The Twig integration for the Yii framework"
,
"keywords"
:
[
"yii"
,
"twig"
,
"renderer"
],
"type"
:
"yii-extension"
,
"type"
:
"yii
2
-extension"
,
"license"
:
"BSD-3-Clause"
,
"support"
:
{
"issues"
:
"https://github.com/yiisoft/yii2/issues?state=open"
,
...
...
@@ -13,7 +13,7 @@
},
"authors"
:
[
{
"name"
:
"Ale
nxa
der Makarov"
,
"name"
:
"Ale
xan
der Makarov"
,
"email"
:
"sam@rmcreative.ru"
}
],
...
...
This diff is collapsed.
Click to expand it.
framework/yii/BaseYii.php
View file @
6e538ac6
...
...
@@ -335,8 +335,7 @@ class BaseYii
include
(
$classFile
);
if
(
YII_DEBUG
&&
!
class_exists
(
$className
,
false
)
&&
!
interface_exists
(
$className
,
false
)
&&
(
!
function_exists
(
'trait_exists'
)
||
!
trait_exists
(
$className
,
false
)))
{
if
(
YII_DEBUG
&&
!
class_exists
(
$className
,
false
)
&&
!
interface_exists
(
$className
,
false
)
&&
!
trait_exists
(
$className
,
false
))
{
throw
new
UnknownClassException
(
"Unable to find '
$className
' in file:
$classFile
"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
framework/yii/base/Application.php
View file @
6e538ac6
...
...
@@ -54,6 +54,13 @@ abstract class Application extends Module
* @event ActionEvent an event raised after executing a controller action.
*/
const
EVENT_AFTER_ACTION
=
'afterAction'
;
/**
* @var string the namespace that controller classes are in. If not set,
* it will use the "app\controllers" namespace.
*/
public
$controllerNamespace
=
'app\\controllers'
;
/**
* @var string the application name.
*/
...
...
@@ -121,7 +128,7 @@ abstract class Application extends Module
* ]
* ~~~
*/
public
$extensions
=
array
()
;
public
$extensions
=
[]
;
/**
* @var string Used to reserve memory for fatal error handler.
...
...
@@ -137,18 +144,8 @@ abstract class Application extends Module
public
function
__construct
(
$config
=
[])
{
Yii
::
$app
=
$this
;
if
(
!
isset
(
$config
[
'id'
]))
{
throw
new
InvalidConfigException
(
'The "id" configuration is required.'
);
}
if
(
isset
(
$config
[
'basePath'
]))
{
$this
->
setBasePath
(
$config
[
'basePath'
]);
unset
(
$config
[
'basePath'
]);
}
else
{
throw
new
InvalidConfigException
(
'The "basePath" configuration is required.'
);
}
$this
->
preInit
(
$config
);
$this
->
registerErrorHandlers
();
$this
->
registerCoreComponents
();
...
...
@@ -158,10 +155,23 @@ abstract class Application extends Module
/**
* Pre-initializes the application.
* This method is called at the beginning of the application constructor.
* It initializes several important application properties.
* If you override this method, please make sure you call the parent implementation.
* @param array $config the application configuration
* @throws InvalidConfigException if either [[id]] or [[basePath]] configuration is missing.
*/
public
function
preInit
(
&
$config
)
{
if
(
!
isset
(
$config
[
'id'
]))
{
throw
new
InvalidConfigException
(
'The "id" configuration is required.'
);
}
if
(
isset
(
$config
[
'basePath'
]))
{
$this
->
setBasePath
(
$config
[
'basePath'
]);
unset
(
$config
[
'basePath'
]);
}
else
{
throw
new
InvalidConfigException
(
'The "basePath" configuration is required.'
);
}
if
(
isset
(
$config
[
'vendorPath'
]))
{
$this
->
setVendorPath
(
$config
[
'vendorPath'
]);
unset
(
$config
[
'vendorPath'
]);
...
...
@@ -176,6 +186,7 @@ abstract class Application extends Module
// set "@runtime"
$this
->
getRuntimePath
();
}
if
(
isset
(
$config
[
'timeZone'
]))
{
$this
->
setTimeZone
(
$config
[
'timeZone'
]);
unset
(
$config
[
'timeZone'
]);
...
...
@@ -185,6 +196,31 @@ abstract class Application extends Module
}
/**
* @inheritdoc
*/
public
function
init
()
{
parent
::
init
();
$this
->
initExtensions
(
$this
->
extensions
);
}
/**
* Initializes the extensions.
* @param array $extensions the extensions to be initialized. Please refer to [[extensions]]
* for the structure of the extension array.
*/
protected
function
initExtensions
(
$extensions
)
{
foreach
(
$extensions
as
$extension
)
{
if
(
isset
(
$extension
[
'bootstrap'
]))
{
/** @var Extension $class */
$class
=
$extension
[
'bootstrap'
];
$class
::
init
();
}
}
}
/**
* Loads components that are declared in [[preload]].
* @throws InvalidConfigException if a component or module to be preloaded is unknown
*/
...
...
@@ -221,6 +257,18 @@ abstract class Application extends Module
}
/**
* Sets the root directory of the applicaition and the @app alias.
* This method can only be invoked at the beginning of the constructor.
* @param string $path the root directory of the application.
* @throws InvalidParamException if the directory does not exist.
*/
public
function
setBasePath
(
$path
)
{
parent
::
setBasePath
(
$path
);
Yii
::
setAlias
(
'@app'
,
$this
->
getBasePath
());
}
/**
* Runs the application.
* This is the main entrance of an application.
* @return integer the exit status (0 means normal, non-zero values mean abnormal)
...
...
This diff is collapsed.
Click to expand it.
framework/yii/base/Extension.php
View file @
6e538ac6
...
...
@@ -8,11 +8,21 @@
namespace
yii\base
;
/**
* Extension is the base class that may be extended by individual extensions.
*
* Extension serves as the bootstrap class for extensions. When an extension
* is installed via composer, the [[init()]] method of its Extension class (if any)
* will be invoked during the application initialization stage.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
Extension
{
/**
* Initializes the extension.
* This method is invoked at the end of [[Application::init()]].
*/
public
static
function
init
()
{
}
...
...
This diff is collapsed.
Click to expand it.
framework/yii/base/Module.php
View file @
6e538ac6
...
...
@@ -83,7 +83,6 @@ abstract class Module extends Component
* it will use the "controllers" sub-namespace under the namespace of this module.
* For example, if the namespace of this module is "foo\bar", then the default
* controller namespace would be "foo\bar\controllers".
* If the module is an application, it will default to "app\controllers".
*/
public
$controllerNamespace
;
/**
...
...
@@ -167,22 +166,20 @@ abstract class Module extends Component
/**
* Initializes the module.
* This method is called after the module is created and initialized with property values
* given in configuration. The default implement will create a path alias using the module [[id]]
* given in configuration. The default implement
ation
will create a path alias using the module [[id]]
* and then call [[preloadComponents()]] to load components that are declared in [[preload]].
*
* If you override this method, please make sure you call the parent implementation.
*/
public
function
init
()
{
$this
->
preloadComponents
();
if
(
$this
->
controllerNamespace
===
null
)
{
if
(
$this
instanceof
Application
)
{
$this
->
controllerNamespace
=
'app\\controllers'
;
}
else
{
$class
=
get_class
(
$this
);
if
((
$pos
=
strrpos
(
$class
,
'\\'
))
!==
false
)
{
$this
->
controllerNamespace
=
substr
(
$class
,
0
,
$pos
)
.
'\\controllers'
;
}
$class
=
get_class
(
$this
);
if
((
$pos
=
strrpos
(
$class
,
'\\'
))
!==
false
)
{
$this
->
controllerNamespace
=
substr
(
$class
,
0
,
$pos
)
.
'\\controllers'
;
}
}
$this
->
preloadComponents
();
}
/**
...
...
@@ -221,9 +218,6 @@ abstract class Module extends Component
$p
=
realpath
(
$path
);
if
(
$p
!==
false
&&
is_dir
(
$p
))
{
$this
->
_basePath
=
$p
;
if
(
$this
instanceof
Application
)
{
Yii
::
setAlias
(
'@app'
,
$p
);
}
}
else
{
throw
new
InvalidParamException
(
"The directory does not exist:
$path
"
);
}
...
...
This diff is collapsed.
Click to expand it.
framework/yii/base/View.php
View file @
6e538ac6
...
...
@@ -540,7 +540,7 @@ class View extends Component
/**
* Registers all files provided by an asset bundle including depending bundles files.
* Removes a bundle from [[assetBundles]] once registered.
* Removes a bundle from [[assetBundles]] once
files are
registered.
* @param string $name name of the bundle to register
*/
private
function
registerAssetFiles
(
$name
)
...
...
@@ -552,7 +552,7 @@ class View extends Component
foreach
(
$bundle
->
depends
as
$dep
)
{
$this
->
registerAssetFiles
(
$dep
);
}
$bundle
->
registerAssets
(
$this
);
$bundle
->
registerAsset
File
s
(
$this
);
unset
(
$this
->
assetBundles
[
$name
]);
}
...
...
This diff is collapsed.
Click to expand it.
framework/yii/db/ActiveRecord.php
View file @
6e538ac6
...
...
@@ -456,7 +456,7 @@ class ActiveRecord extends Model
* ~~~
* public function getCountry()
* {
* return $this->hasOne(
'Country'
, ['id' => 'country_id']);
* return $this->hasOne(
Country::className()
, ['id' => 'country_id']);
* }
* ~~~
*
...
...
@@ -475,7 +475,7 @@ class ActiveRecord extends Model
public
function
hasOne
(
$class
,
$link
)
{
return
new
ActiveRelation
([
'modelClass'
=>
$
this
->
getNamespacedClass
(
$class
)
,
'modelClass'
=>
$
class
,
'primaryModel'
=>
$this
,
'link'
=>
$link
,
'multiple'
=>
false
,
...
...
@@ -496,7 +496,7 @@ class ActiveRecord extends Model
* ~~~
* public function getOrders()
* {
* return $this->hasMany(
'Order'
, ['customer_id' => 'id']);
* return $this->hasMany(
Order::className()
, ['customer_id' => 'id']);
* }
* ~~~
*
...
...
@@ -513,7 +513,7 @@ class ActiveRecord extends Model
public
function
hasMany
(
$class
,
$link
)
{
return
new
ActiveRelation
([
'modelClass'
=>
$
this
->
getNamespacedClass
(
$class
)
,
'modelClass'
=>
$
class
,
'primaryModel'
=>
$this
,
'link'
=>
$link
,
'multiple'
=>
true
,
...
...
@@ -1439,24 +1439,6 @@ class ActiveRecord extends Model
}
/**
* Changes the given class name into a namespaced one.
* If the given class name is already namespaced, no change will be made.
* Otherwise, the class name will be changed to use the same namespace as
* the current AR class.
* @param string $class the class name to be namespaced
* @return string the namespaced class name
*/
protected
static
function
getNamespacedClass
(
$class
)
{
if
(
strpos
(
$class
,
'\\'
)
===
false
)
{
$reflector
=
new
\ReflectionClass
(
static
::
className
());
return
$reflector
->
getNamespaceName
()
.
'\\'
.
$class
;
}
else
{
return
$class
;
}
}
/**
* @param array $link
* @param ActiveRecord $foreignModel
* @param ActiveRecord $primaryModel
...
...
This diff is collapsed.
Click to expand it.
framework/yii/debug/views/default/index.php
View file @
6e538ac6
...
...
@@ -32,11 +32,11 @@ $this->title = 'Yii Debugger';
<tbody>
<?php
foreach
(
$manifest
as
$tag
=>
$data
)
:
?>
<tr>
<td>
<?=
Html
::
a
(
$tag
,
[
'view'
,
'tag'
=>
$tag
]);
?>
</td>
<td>
<?=
date
(
'Y-m-d h:i:sa'
,
$data
[
'time'
]);
?>
</td>
<td>
<?=
$data
[
'ip'
];
?>
</td>
<td>
<?=
$data
[
'method'
];
?>
</td>
<td>
<?=
$data
[
'url'
];
?>
</td>
<td>
<?=
Html
::
a
(
$tag
,
[
'view'
,
'tag'
=>
$tag
])
?>
</td>
<td>
<?=
date
(
'Y-m-d h:i:sa'
,
$data
[
'time'
])
?>
</td>
<td>
<?=
$data
[
'ip'
]
?>
</td>
<td>
<?=
$data
[
'method'
]
?>
</td>
<td>
<?=
$data
[
'url'
]
?>
</td>
</tr>
<?php
endforeach
;
?>
</tbody>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/debug/views/default/toolbar.php
View file @
6e538ac6
...
...
@@ -26,13 +26,13 @@ $url = $panels['request']->getUrl();
?>
<div
id=
"yii-debug-toolbar"
>
<?php
foreach
(
$panels
as
$panel
)
:
?>
<?=
$panel
->
getSummary
();
?>
<?=
$panel
->
getSummary
()
?>
<?php
endforeach
;
?>
<span
class=
"yii-debug-toolbar-toggler"
onclick=
"
<?=
$minJs
;
?>
"
>
›
</span>
<span
class=
"yii-debug-toolbar-toggler"
onclick=
"
<?=
$minJs
?>
"
>
›
</span>
</div>
<div
id=
"yii-debug-toolbar-min"
>
<a
href=
"
<?=
$url
;
?>
"
title=
"Open Yii Debugger"
id=
"yii-debug-toolbar-logo"
>
<img
width=
"29"
height=
"30"
alt=
""
src=
"
<?=
ConfigPanel
::
getYiiLogo
();
?>
"
>
<a
href=
"
<?=
$url
?>
"
title=
"Open Yii Debugger"
id=
"yii-debug-toolbar-logo"
>
<img
width=
"29"
height=
"30"
alt=
""
src=
"
<?=
ConfigPanel
::
getYiiLogo
()
?>
"
>
</a>
<span
class=
"yii-debug-toolbar-toggler"
onclick=
"
<?=
$maxJs
;
?>
"
>
‹
</span>
<span
class=
"yii-debug-toolbar-toggler"
onclick=
"
<?=
$maxJs
?>
"
>
‹
</span>
</div>
This diff is collapsed.
Click to expand it.
framework/yii/debug/views/default/view.php
View file @
6e538ac6
...
...
@@ -21,7 +21,7 @@ $this->title = 'Yii Debugger';
Yii Debugger
</div>
<?php
foreach
(
$panels
as
$panel
)
:
?>
<?=
$panel
->
getSummary
();
?>
<?=
$panel
->
getSummary
()
?>
<?php
endforeach
;
?>
</div>
...
...
@@ -71,7 +71,7 @@ $this->title = 'Yii Debugger';
echo
' at '
.
date
(
'Y-m-d h:i:s a'
,
$summary
[
'time'
])
.
' by '
.
$summary
[
'ip'
];
?>
</div>
<?=
$activePanel
->
getDetail
();
?>
<?=
$activePanel
->
getDetail
()
?>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/debug/views/layouts/main.php
View file @
6e538ac6
...
...
@@ -11,12 +11,12 @@ yii\debug\DebugAsset::register($this);
<html>
<?php
$this
->
beginPage
();
?>
<head>
<title>
<?=
Html
::
encode
(
$this
->
title
);
?>
</title>
<title>
<?=
Html
::
encode
(
$this
->
title
)
?>
</title>
<?php
$this
->
head
();
?>
</head>
<body>
<?php
$this
->
beginBody
();
?>
<?=
$content
;
?>
<?=
$content
?>
<?php
$this
->
endBody
();
?>
</body>
<?php
$this
->
endPage
();
?>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/controller/templates/controller.php
View file @
6e538ac6
...
...
@@ -13,15 +13,15 @@ echo "<?php\n";
?>
<?php
if
(
!
empty
(
$generator
->
ns
))
:
?>
namespace
<?=
$generator
->
ns
;
?>
;
namespace
<?=
$generator
->
ns
?>
;
<?php
endif
;
?>
class
<?=
$generator
->
getControllerClass
();
?>
extends
<?=
'\\'
.
trim
(
$generator
->
baseClass
,
'\\'
)
.
"
\n
"
;
?>
class
<?=
$generator
->
getControllerClass
()
?>
extends
<?=
'\\'
.
trim
(
$generator
->
baseClass
,
'\\'
)
.
"
\n
"
?>
{
<?php
foreach
(
$generator
->
getActionIDs
()
as
$action
)
:
?>
public function action
<?=
Inflector
::
id2camel
(
$action
);
?>
()
public function action
<?=
Inflector
::
id2camel
(
$action
)
?>
()
{
return $this->render('
<?=
$action
;
?>
');
return $this->render('
<?=
$action
?>
');
}
<?php
endforeach
;
?>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/controller/templates/view.php
View file @
6e538ac6
...
...
@@ -12,11 +12,11 @@ echo "<?php\n";
/**
* @var yii\base\View $this
*/
<?=
"?>"
;
?>
<?=
"?>"
?>
<h1>
<?=
$generator
->
getControllerID
()
.
'/'
.
$action
;
?>
</h1>
<h1>
<?=
$generator
->
getControllerID
()
.
'/'
.
$action
?>
</h1>
<p>
You may change the content of this page by modifying
the file
<code>
<?=
'<?php'
;
?>
echo __FILE__; ?>
</code>
.
the file
<code>
<?=
'<?php'
?>
echo __FILE__; ?>
</code>
.
</p>
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/crud/Generator.php
View file @
6e538ac6
...
...
@@ -190,9 +190,9 @@ class Generator extends \yii\gii\Generator
}
$column
=
$tableSchema
->
columns
[
$attribute
];
if
(
$column
->
phpType
===
'boolean'
)
{
return
"
\$
form->field(
\$
model, '
$attribute
')->checkbox()
;
"
;
return
"
\$
form->field(
\$
model, '
$attribute
')->checkbox()"
;
}
elseif
(
$column
->
type
===
'text'
)
{
return
"
\$
form->field(
\$
model, '
$attribute
')->textarea(['rows' => 6])
;
"
;
return
"
\$
form->field(
\$
model, '
$attribute
')->textarea(['rows' => 6])"
;
}
else
{
if
(
preg_match
(
'/^(password|pass|passwd|passcode)$/i'
,
$column
->
name
))
{
$input
=
'passwordInput'
;
...
...
@@ -200,9 +200,9 @@ class Generator extends \yii\gii\Generator
$input
=
'textInput'
;
}
if
(
$column
->
phpType
!==
'string'
||
$column
->
size
===
null
)
{
return
"
\$
form->field(
\$
model, '
$attribute
')->
$input
()
;
"
;
return
"
\$
form->field(
\$
model, '
$attribute
')->
$input
()"
;
}
else
{
return
"
\$
form->field(
\$
model, '
$attribute
')->
$input
(['maxlength' =>
$column->size
])
;
"
;
return
"
\$
form->field(
\$
model, '
$attribute
')->
$input
(['maxlength' =>
$column->size
])"
;
}
}
}
...
...
@@ -216,9 +216,9 @@ class Generator extends \yii\gii\Generator
$tableSchema
=
$this
->
getTableSchema
();
$column
=
$tableSchema
->
columns
[
$attribute
];
if
(
$column
->
phpType
===
'boolean'
)
{
return
"
\$
form->field(
\$
model, '
$attribute
')->checkbox()
;
"
;
return
"
\$
form->field(
\$
model, '
$attribute
')->checkbox()"
;
}
else
{
return
"
\$
form->field(
\$
model, '
$attribute
')
;
"
;
return
"
\$
form->field(
\$
model, '
$attribute
')"
;
}
}
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/crud/templates/controller.php
View file @
6e538ac6
...
...
@@ -21,19 +21,19 @@ $actionParamComments = $generator->generateActionParamComments();
echo
"<?php
\n
"
;
?>
namespace
<?=
StringHelper
::
dirname
(
ltrim
(
$generator
->
controllerClass
,
'\\'
));
?>
;
namespace
<?=
StringHelper
::
dirname
(
ltrim
(
$generator
->
controllerClass
,
'\\'
))
?>
;
use
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
);
?>
;
use
<?=
ltrim
(
$generator
->
searchModelClass
,
'\\'
);
?>
;
use
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
)
?>
;
use
<?=
ltrim
(
$generator
->
searchModelClass
,
'\\'
)
?>
;
use yii\data\ActiveDataProvider;
use
<?=
ltrim
(
$generator
->
baseControllerClass
,
'\\'
);
?>
;
use
<?=
ltrim
(
$generator
->
baseControllerClass
,
'\\'
)
?>
;
use yii\web\HttpException;
use yii\web\VerbFilter;
/**
*
<?=
$controllerClass
;
?>
implements the CRUD actions for
<?=
$modelClass
;
?>
model.
*
<?=
$controllerClass
?>
implements the CRUD actions for
<?=
$modelClass
?>
model.
*/
class
<?=
$controllerClass
;
?>
extends
<?=
StringHelper
::
basename
(
$generator
->
baseControllerClass
)
.
"
\n
"
;
?>
class
<?=
$controllerClass
?>
extends
<?=
StringHelper
::
basename
(
$generator
->
baseControllerClass
)
.
"
\n
"
?>
{
public function behaviors()
{
...
...
@@ -48,12 +48,12 @@ class <?=$controllerClass; ?> extends <?=StringHelper::basename($generator->base
}
/**
* Lists all
<?=
$modelClass
;
?>
models.
* Lists all
<?=
$modelClass
?>
models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new
<?=
$searchModelClass
;
?>
;
$searchModel = new
<?=
$searchModelClass
?>
;
$dataProvider = $searchModel->search($_GET);
return $this->render('index', [
...
...
@@ -63,28 +63,28 @@ class <?=$controllerClass; ?> extends <?=StringHelper::basename($generator->base
}
/**
* Displays a single
<?=
$modelClass
;
?>
model.
*
<?=
implode
(
"
\n\t
* "
,
$actionParamComments
)
.
"
\n
"
;
?>
* Displays a single
<?=
$modelClass
?>
model.
*
<?=
implode
(
"
\n\t
* "
,
$actionParamComments
)
.
"
\n
"
?>
* @return mixed
*/
public function actionView(
<?=
$actionParams
;
?>
)
public function actionView(
<?=
$actionParams
?>
)
{
return $this->render('view', [
'model' => $this->findModel(
<?=
$actionParams
;
?>
),
'model' => $this->findModel(
<?=
$actionParams
?>
),
]);
}
/**
* Creates a new
<?=
$modelClass
;
?>
model.
* Creates a new
<?=
$modelClass
?>
model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new
<?=
$modelClass
;
?>
;
$model = new
<?=
$modelClass
?>
;
if ($model->load($_POST)
&&
$model->save()) {
return $this->redirect(['view',
<?=
$urlParams
;
?>
]);
return $this->redirect(['view',
<?=
$urlParams
?>
]);
} else {
return $this->render('create', [
'model' => $model,
...
...
@@ -93,17 +93,17 @@ class <?=$controllerClass; ?> extends <?=StringHelper::basename($generator->base
}
/**
* Updates an existing
<?=
$modelClass
;
?>
model.
* Updates an existing
<?=
$modelClass
?>
model.
* If update is successful, the browser will be redirected to the 'view' page.
*
<?=
implode
(
"
\n\t
* "
,
$actionParamComments
)
.
"
\n
"
;
?>
*
<?=
implode
(
"
\n\t
* "
,
$actionParamComments
)
.
"
\n
"
?>
* @return mixed
*/
public function actionUpdate(
<?=
$actionParams
;
?>
)
public function actionUpdate(
<?=
$actionParams
?>
)
{
$model = $this->findModel(
<?=
$actionParams
;
?>
);
$model = $this->findModel(
<?=
$actionParams
?>
);
if ($model->load($_POST)
&&
$model->save()) {
return $this->redirect(['view',
<?=
$urlParams
;
?>
]);
return $this->redirect(['view',
<?=
$urlParams
?>
]);
} else {
return $this->render('update', [
'model' => $model,
...
...
@@ -112,25 +112,25 @@ class <?=$controllerClass; ?> extends <?=StringHelper::basename($generator->base
}
/**
* Deletes an existing
<?=
$modelClass
;
?>
model.
* Deletes an existing
<?=
$modelClass
?>
model.
* If deletion is successful, the browser will be redirected to the 'index' page.
*
<?=
implode
(
"
\n\t
* "
,
$actionParamComments
)
.
"
\n
"
;
?>
*
<?=
implode
(
"
\n\t
* "
,
$actionParamComments
)
.
"
\n
"
?>
* @return mixed
*/
public function actionDelete(
<?=
$actionParams
;
?>
)
public function actionDelete(
<?=
$actionParams
?>
)
{
$this->findModel(
<?=
$actionParams
;
?>
)->delete();
$this->findModel(
<?=
$actionParams
?>
)->delete();
return $this->redirect(['index']);
}
/**
* Finds the
<?=
$modelClass
;
?>
model based on its primary key value.
* Finds the
<?=
$modelClass
?>
model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
*
<?=
implode
(
"
\n\t
* "
,
$actionParamComments
)
.
"
\n
"
;
?>
* @return
<?=
$modelClass
;
?>
the loaded model
*
<?=
implode
(
"
\n\t
* "
,
$actionParamComments
)
.
"
\n
"
?>
* @return
<?=
$modelClass
?>
the loaded model
* @throws HttpException if the model cannot be found
*/
protected function findModel(
<?=
$actionParams
;
?>
)
protected function findModel(
<?=
$actionParams
?>
)
{
<?php
if
(
count
(
$pks
)
===
1
)
{
...
...
@@ -143,7 +143,7 @@ if (count($pks) === 1) {
$condition
=
'['
.
implode
(
', '
,
$condition
)
.
']'
;
}
?>
if (($model =
<?=
$modelClass
;
?>
::find(
<?=
$condition
;
?>
)) !== null) {
if (($model =
<?=
$modelClass
?>
::find(
<?=
$condition
?>
)) !== null) {
return $model;
} else {
throw new HttpException(404, 'The requested page does not exist.');
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/crud/templates/search.php
View file @
6e538ac6
...
...
@@ -19,23 +19,23 @@ $searchConditions = $generator->generateSearchConditions();
echo
"<?php
\n
"
;
?>
namespace
<?=
StringHelper
::
dirname
(
ltrim
(
$generator
->
searchModelClass
,
'\\'
));
?>
;
namespace
<?=
StringHelper
::
dirname
(
ltrim
(
$generator
->
searchModelClass
,
'\\'
))
?>
;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
);
?>
;
use
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
)
?>
;
/**
*
<?=
$searchModelClass
;
?>
represents the model behind the search form about
<?=
$modelClass
;
?>
.
*
<?=
$searchModelClass
?>
represents the model behind the search form about
<?=
$modelClass
?>
.
*/
class
<?=
$searchModelClass
;
?>
extends Model
class
<?=
$searchModelClass
?>
extends Model
{
public $
<?=
implode
(
";
\n\t
public $"
,
$searchAttributes
);
?>
;
public $
<?=
implode
(
";
\n\t
public $"
,
$searchAttributes
)
?>
;
public function rules()
{
return [
<?=
implode
(
",
\n\t\t\t
"
,
$rules
);
?>
,
<?=
implode
(
",
\n\t\t\t
"
,
$rules
)
?>
,
];
}
...
...
@@ -46,14 +46,14 @@ class <?=$searchModelClass; ?> extends Model
{
return [
<?php
foreach
(
$labels
as
$name
=>
$label
)
:
?>
<?=
"'
$name
' => '"
.
addslashes
(
$label
)
.
"',
\n
"
;
?>
<?=
"'
$name
' => '"
.
addslashes
(
$label
)
.
"',
\n
"
?>
<?php
endforeach
;
?>
];
}
public function search($params)
{
$query =
<?=
$modelClass
;
?>
::find();
$query =
<?=
$modelClass
?>
::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
...
...
@@ -62,7 +62,7 @@ class <?=$searchModelClass; ?> extends Model
return $dataProvider;
}
<?=
implode
(
"
\n\t\t
"
,
$searchConditions
);
?>
<?=
implode
(
"
\n\t\t
"
,
$searchConditions
)
?>
return $dataProvider;
}
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/crud/templates/views/_form.php
View file @
6e538ac6
...
...
@@ -23,22 +23,22 @@ use yii\widgets\ActiveForm;
/**
* @var yii\base\View $this
* @var
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
);
?>
$model
* @var
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
)
?>
$model
* @var yii\widgets\ActiveForm $form
*/
?>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
));
?>
-form"
>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
))
?>
-form"
>
<?=
'<?php'
;
?>
$form = ActiveForm::begin(); ?>
<?=
"<?php "
?>
$form = ActiveForm::begin(); ?>
<?php
foreach
(
$safeAttributes
as
$attribute
)
{
echo
"
\t\t
<?="
.
$generator
->
generateActiveField
(
$attribute
)
.
" ?>
\n\n
"
;
echo
"
\t\t
<?=
"
.
$generator
->
generateActiveField
(
$attribute
)
.
" ?>
\n\n
"
;
}
?>
<div
class=
"form-group"
>
<?=
'<?php'
;
?>
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
<?=
"<?= "
?>
Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary'])
?>
</div>
<?=
'<?php'
;
?>
ActiveForm::end(); ?>
<?=
"<?php "
?>
ActiveForm::end(); ?>
</div>
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/crud/templates/views/_search.php
View file @
6e538ac6
...
...
@@ -16,14 +16,14 @@ use yii\widgets\ActiveForm;
/**
* @var yii\base\View $this
* @var
<?=
ltrim
(
$generator
->
searchModelClass
,
'\\'
);
?>
$model
* @var
<?=
ltrim
(
$generator
->
searchModelClass
,
'\\'
)
?>
$model
* @var yii\widgets\ActiveForm $form
*/
?>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
));
?>
-search"
>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
))
?>
-search"
>
<?=
'<?php'
;
?>
$form = ActiveForm::begin([
<?=
"<?php "
?>
$form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
...
...
@@ -32,17 +32,17 @@ use yii\widgets\ActiveForm;
$count
=
0
;
foreach
(
$generator
->
getTableSchema
()
->
getColumnNames
()
as
$attribute
)
{
if
(
++
$count
<
6
)
{
echo
"
\t\t
<?=
"
.
$generator
->
generateActiveSearchField
(
$attribute
)
.
" ?>
\n
"
;
echo
"
\t\t
<?=
"
.
$generator
->
generateActiveSearchField
(
$attribute
)
.
" ?>
\n
\n
"
;
}
else
{
echo
"
\t\t
<?
php // echo "
.
$generator
->
generateActiveSearchField
(
$attribute
)
.
" ?>
\n
"
;
echo
"
\t\t
<?
= // "
.
$generator
->
generateActiveSearchField
(
$attribute
)
.
" ?>
\n
\n
"
;
}
}
?>
<div
class=
"form-group"
>
<?=
'<?php'
;
?>
echo Html::submitButton('Search', ['class' => 'btn btn-primary']);
?>
<?=
'<?php'
;
?>
echo Html::resetButton('Reset', ['class' => 'btn btn-default']);
?>
<?=
"<?= "
?>
Html::submitButton('Search', ['class' => 'btn btn-primary'])
?>
<?=
"<?= "
?>
Html::resetButton('Reset', ['class' => 'btn btn-default'])
?>
</div>
<?=
'<?php'
;
?>
ActiveForm::end(); ?>
<?=
"<?php "
?>
ActiveForm::end(); ?>
</div>
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/crud/templates/views/create.php
View file @
6e538ac6
...
...
@@ -15,18 +15,18 @@ use yii\helpers\Html;
/**
* @var yii\base\View $this
* @var
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
);
?>
$model
* @var
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
)
?>
$model
*/
$this->title = 'Create
<?=
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
));
?>
';
$this->params['breadcrumbs'][] = ['label' => '
<?=
Inflector
::
pluralize
(
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
)));
?>
', 'url' => ['index']];
$this->title = 'Create
<?=
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
))
?>
';
$this->params['breadcrumbs'][] = ['label' => '
<?=
Inflector
::
pluralize
(
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
)))
?>
', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
));
?>
-create"
>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
))
?>
-create"
>
<h1>
<?=
"<?php"
;
?>
echo Html::encode($this->title);
?>
</h1>
<h1>
<?=
"<?= "
?>
Html::encode($this->title)
?>
</h1>
<?=
"<?php"
;
?>
echo $this->render('_form', [
<?=
"<?php "
?>
echo $this->render('_form', [
'model' => $model,
]); ?>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/crud/templates/views/index.php
View file @
6e538ac6
...
...
@@ -15,29 +15,29 @@ echo "<?php\n";
?>
use yii\helpers\Html;
use
<?=
$generator
->
indexWidgetType
===
'grid'
?
'yii\grid\GridView'
:
'yii\widgets\ListView'
;
?>
;
use
<?=
$generator
->
indexWidgetType
===
'grid'
?
"yii\grid\GridView"
:
"yii\widgets\ListView"
?>
;
/**
* @var yii\base\View $this
* @var yii\data\ActiveDataProvider $dataProvider
* @var
<?=
ltrim
(
$generator
->
searchModelClass
,
'\\'
);
?>
$searchModel
* @var
<?=
ltrim
(
$generator
->
searchModelClass
,
'\\'
)
?>
$searchModel
*/
$this->title = '
<?=
Inflector
::
pluralize
(
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
)));
?>
';
$this->title = '
<?=
Inflector
::
pluralize
(
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
)))
?>
';
$this->params['breadcrumbs'][] = $this->title;
?>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
));
?>
-index"
>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
))
?>
-index"
>
<h1>
<?=
"<?php"
;
?>
echo Html::encode($this->title);
?>
</h1>
<h1>
<?=
"<?= "
?>
Html::encode($this->title)
?>
</h1>
<?=
'<?php'
.
(
$generator
->
indexWidgetType
===
'grid'
?
' //'
:
''
);
?>
echo $this->render('_search', ['model' => $searchModel]); ?>
<?=
"<?php "
.
(
$generator
->
indexWidgetType
===
'grid'
?
"// "
:
""
)
?>
echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?=
'<?php'
;
?>
echo Html::a('Create
<?=
StringHelper
::
basename
(
$generator
->
modelClass
);
?>
', ['create'], ['class' => 'btn btn-success']);
?>
<?=
"<?= "
?>
Html::a('Create
<?=
StringHelper
::
basename
(
$generator
->
modelClass
)
?>
', ['create'], ['class' => 'btn btn-success'])
?>
</p>
<?php
if
(
$generator
->
indexWidgetType
===
'grid'
)
:
?>
<?=
"<?php"
;
?>
echo GridView::widget([
<?=
"<?php "
?>
echo GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
...
...
@@ -48,9 +48,9 @@ $count = 0;
foreach
(
$generator
->
getTableSchema
()
->
columns
as
$column
)
{
$format
=
$generator
->
generateColumnFormat
(
$column
);
if
(
++
$count
<
6
)
{
echo
"
\t\t\t
'"
.
$column
->
name
.
(
$format
===
'text'
?
''
:
':'
.
$format
)
.
"',
\n
"
;
echo
"
\t\t\t
'"
.
$column
->
name
.
(
$format
===
'text'
?
""
:
":"
.
$format
)
.
"',
\n
"
;
}
else
{
echo
"
\t\t\t
// '"
.
$column
->
name
.
(
$format
===
'text'
?
''
:
':'
.
$format
)
.
"',
\n
"
;
echo
"
\t\t\t
// '"
.
$column
->
name
.
(
$format
===
'text'
?
""
:
":"
.
$format
)
.
"',
\n
"
;
}
}
?>
...
...
@@ -59,11 +59,11 @@ foreach ($generator->getTableSchema()->columns as $column) {
],
]); ?>
<?php
else
:
?>
<?=
"<?php"
;
?>
echo ListView::widget([
<?=
"<?php "
?>
echo ListView::widget([
'dataProvider' => $dataProvider,
'itemOptions' => ['class' => 'item'],
'itemView' => function ($model, $key, $index, $widget) {
return Html::a(Html::encode($model->
<?=
$nameAttribute
;
?>
), ['view',
<?=
$urlParams
;
?>
]);
return Html::a(Html::encode($model->
<?=
$nameAttribute
?>
), ['view',
<?=
$urlParams
?>
]);
},
]); ?>
<?php
endif
;
?>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/crud/templates/views/update.php
View file @
6e538ac6
...
...
@@ -17,19 +17,19 @@ use yii\helpers\Html;
/**
* @var yii\base\View $this
* @var
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
);
?>
$model
* @var
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
)
?>
$model
*/
$this->title = 'Update
<?=
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
));
?>
: ' . $model->
<?=
$generator
->
getNameAttribute
();
?>
;
$this->params['breadcrumbs'][] = ['label' => '
<?=
Inflector
::
pluralize
(
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
)));
?>
', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->
<?=
$generator
->
getNameAttribute
();
?>
, 'url' => ['view',
<?=
$urlParams
;
?>
]];
$this->title = 'Update
<?=
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
))
?>
: ' . $model->
<?=
$generator
->
getNameAttribute
()
?>
;
$this->params['breadcrumbs'][] = ['label' => '
<?=
Inflector
::
pluralize
(
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
)))
?>
', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->
<?=
$generator
->
getNameAttribute
()
?>
, 'url' => ['view',
<?=
$urlParams
?>
]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
));
?>
-update"
>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
))
?>
-update"
>
<h1>
<?=
"<?php"
;
?>
echo Html::encode($this->title);
?>
</h1>
<h1>
<?=
"<?= "
?>
Html::encode($this->title)
?>
</h1>
<?=
"<?php"
;
?>
echo $this->render('_form', [
<?=
"<?php "
?>
echo $this->render('_form', [
'model' => $model,
]); ?>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/crud/templates/views/view.php
View file @
6e538ac6
...
...
@@ -18,33 +18,33 @@ use yii\widgets\DetailView;
/**
* @var yii\base\View $this
* @var
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
);
?>
$model
* @var
<?=
ltrim
(
$generator
->
modelClass
,
'\\'
)
?>
$model
*/
$this->title = $model->
<?=
$generator
->
getNameAttribute
();
?>
;
$this->params['breadcrumbs'][] = ['label' => '
<?=
Inflector
::
pluralize
(
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
)));
?>
', 'url' => ['index']];
$this->title = $model->
<?=
$generator
->
getNameAttribute
()
?>
;
$this->params['breadcrumbs'][] = ['label' => '
<?=
Inflector
::
pluralize
(
Inflector
::
camel2words
(
StringHelper
::
basename
(
$generator
->
modelClass
)))
?>
', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
));
?>
-view"
>
<div
class=
"
<?=
Inflector
::
camel2id
(
StringHelper
::
basename
(
$generator
->
modelClass
))
?>
-view"
>
<h1>
<?=
"<?php"
;
?>
echo Html::encode($this->title);
?>
</h1>
<h1>
<?=
"<?= "
?>
Html::encode($this->title)
?>
</h1>
<p>
<?=
'<?php'
;
?>
echo Html::a('Update', ['update',
<?=
$urlParams
;
?>
], ['class' => 'btn btn-primary']);
?>
<?=
'<?php'
;
?>
echo Html::a('Delete', ['delete',
<?=
$urlParams
;
?>
], [
<?=
"<?= "
?>
Html::a('Update', ['update',
<?=
$urlParams
?>
], ['class' => 'btn btn-primary'])
?>
<?=
"<?php "
?>
echo Html::a('Delete', ['delete',
<?=
$urlParams
?>
], [
'class' => 'btn btn-danger',
'data-confirm' => Yii::t('app', 'Are you sure to delete this item?'),
'data-method' => 'post',
]); ?>
</p>
<?=
'<?php'
;
?>
echo DetailView::widget([
<?=
"<?php "
?>
echo DetailView::widget([
'model' => $model,
'attributes' => [
<?php
foreach
(
$generator
->
getTableSchema
()
->
columns
as
$column
)
{
$format
=
$generator
->
generateColumnFormat
(
$column
);
echo
"
\t\t\t
'"
.
$column
->
name
.
(
$format
===
'text'
?
''
:
':'
.
$format
)
.
"',
\n
"
;
echo
"
\t\t\t
'"
.
$column
->
name
.
(
$format
===
'text'
?
""
:
":"
.
$format
)
.
"',
\n
"
;
}
?>
],
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/form/templates/action.php
View file @
6e538ac6
...
...
@@ -12,9 +12,9 @@ use yii\helpers\Inflector;
echo
"<?php
\n
"
;
?>
public function action
<?=
Inflector
::
id2camel
(
trim
(
basename
(
$generator
->
viewName
),
'_'
));
?>
()
public function action
<?=
Inflector
::
id2camel
(
trim
(
basename
(
$generator
->
viewName
),
'_'
))
?>
()
{
$model = new
<?=
$generator
->
modelClass
;
?><?=
empty
(
$generator
->
scenarioName
)
?
''
:
"(['scenario' => '
{
$generator
->
scenarioName
}
'])"
;
?>
;
$model = new
<?=
$generator
->
modelClass
?><?=
empty
(
$generator
->
scenarioName
)
?
''
:
"(['scenario' => '
{
$generator
->
scenarioName
}
'])"
?>
;
if ($model->load($_POST)) {
if($model->validate()) {
...
...
@@ -22,7 +22,7 @@ public function action<?=Inflector::id2camel(trim(basename($generator->viewName)
return;
}
}
return $this->render('
<?=
$generator
->
viewName
;
?>
', [
return $this->render('
<?=
$generator
->
viewName
?>
', [
'model' => $model,
]);
}
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/form/templates/form.php
View file @
6e538ac6
...
...
@@ -14,22 +14,22 @@ use yii\widgets\ActiveForm;
/**
* @var yii\base\View $this
* @var
<?=
$generator
->
modelClass
;
?>
$model
* @var
<?=
$generator
->
modelClass
?>
$model
* @var ActiveForm $form
*/
<?=
"?>"
;
?>
<?=
"?>"
?>
<div
class=
"
<?=
str_replace
(
'/'
,
'-'
,
trim
(
$generator
->
viewName
,
'_'
));
?>
"
>
<div
class=
"
<?=
str_replace
(
'/'
,
'-'
,
trim
(
$generator
->
viewName
,
'_'
))
?>
"
>
<?=
'<?php'
;
?>
$form = ActiveForm::begin(); ?>
<?=
'<?php'
?>
$form = ActiveForm::begin(); ?>
<?php
foreach
(
$generator
->
getModelAttributes
()
as
$attribute
)
:
?>
<?=
'<?php'
;
?>
echo $form->field($model, '
<?=
$attribute
;
?>
'); ?>
<?=
'<?php'
?>
echo $form->field($model, '
<?=
$attribute
?>
'); ?>
<?php
endforeach
;
?>
<div
class=
"form-group"
>
<?=
'<?php'
;
?>
echo Html::submitButton('Submit', ['class' => 'btn btn-primary']); ?>
<?=
'<?php'
?>
echo Html::submitButton('Submit', ['class' => 'btn btn-primary']); ?>
</div>
<?=
'<?php'
;
?>
ActiveForm::end(); ?>
<?=
'<?php'
?>
ActiveForm::end(); ?>
</div>
<!--
<?=
str_replace
(
'/'
,
'-'
,
trim
(
$generator
->
viewName
,
'-'
));
?>
-->
</div>
<!--
<?=
str_replace
(
'/'
,
'-'
,
trim
(
$generator
->
viewName
,
'-'
))
?>
-->
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/model/templates/model.php
View file @
6e538ac6
...
...
@@ -15,29 +15,29 @@
echo
"<?php
\n
"
;
?>
namespace
<?=
$generator
->
ns
;
?>
;
namespace
<?=
$generator
->
ns
?>
;
/**
* This is the model class for table "
<?=
$tableName
;
?>
".
* This is the model class for table "
<?=
$tableName
?>
".
*
<?php
foreach
(
$tableSchema
->
columns
as
$column
)
:
?>
* @property
<?=
"
{
$column
->
phpType
}
\$
{
$column
->
name
}
\n
"
;
?>
* @property
<?=
"
{
$column
->
phpType
}
\$
{
$column
->
name
}
\n
"
?>
<?php
endforeach
;
?>
<?php
if
(
!
empty
(
$relations
))
:
?>
*
<?php
foreach
(
$relations
as
$name
=>
$relation
)
:
?>
* @property
<?=
$relation
[
1
]
.
(
$relation
[
2
]
?
'[]'
:
''
)
.
' $'
.
lcfirst
(
$name
)
.
"
\n
"
;
?>
* @property
<?=
$relation
[
1
]
.
(
$relation
[
2
]
?
'[]'
:
''
)
.
' $'
.
lcfirst
(
$name
)
.
"
\n
"
?>
<?php
endforeach
;
?>
<?php
endif
;
?>
*/
class
<?=
$className
;
?>
extends
<?=
'\\'
.
ltrim
(
$generator
->
baseClass
,
'\\'
)
.
"
\n
"
;
?>
class
<?=
$className
?>
extends
<?=
'\\'
.
ltrim
(
$generator
->
baseClass
,
'\\'
)
.
"
\n
"
?>
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '
<?=
$tableName
;
?>
';
return '
<?=
$tableName
?>
';
}
/**
...
...
@@ -45,7 +45,7 @@ class <?=$className; ?> extends <?='\\' . ltrim($generator->baseClass, '\\') . "
*/
public function rules()
{
return [
<?=
"
\n\t\t\t
"
.
implode
(
",
\n\t\t\t
"
,
$rules
)
.
"
\n\t\t
"
;
?>
];
return [
<?=
"
\n\t\t\t
"
.
implode
(
",
\n\t\t\t
"
,
$rules
)
.
"
\n\t\t
"
?>
];
}
/**
...
...
@@ -55,7 +55,7 @@ class <?=$className; ?> extends <?='\\' . ltrim($generator->baseClass, '\\') . "
{
return [
<?php
foreach
(
$labels
as
$name
=>
$label
)
:
?>
<?=
"'
$name
' => '"
.
addslashes
(
$label
)
.
"',
\n
"
;
?>
<?=
"'
$name
' => '"
.
addslashes
(
$label
)
.
"',
\n
"
?>
<?php
endforeach
;
?>
];
}
...
...
@@ -64,9 +64,9 @@ class <?=$className; ?> extends <?='\\' . ltrim($generator->baseClass, '\\') . "
/**
* @return \yii\db\ActiveRelation
*/
public function get
<?=
$name
;
?>
()
public function get
<?=
$name
?>
()
{
<?=
$relation
[
0
]
.
"
\n
"
;
?>
<?=
$relation
[
0
]
.
"
\n
"
?>
}
<?php
endforeach
;
?>
}
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/module/templates/controller.php
View file @
6e538ac6
...
...
@@ -8,7 +8,7 @@
echo
"<?php
\n
"
;
?>
namespace
<?=
$generator
->
getControllerNamespace
();
?>
;
namespace
<?=
$generator
->
getControllerNamespace
()
?>
;
use yii\web\Controller;
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/module/templates/module.php
View file @
6e538ac6
...
...
@@ -13,12 +13,12 @@ $className = substr($className, $pos + 1);
echo
"<?php
\n
"
;
?>
namespace
<?=
$ns
;
?>
;
namespace
<?=
$ns
?>
;
class
<?=
$className
;
?>
extends \yii\base\Module
class
<?=
$className
?>
extends \yii\base\Module
{
public $controllerNamespace = '
<?=
$generator
->
getControllerNamespace
();
?>
';
public $controllerNamespace = '
<?=
$generator
->
getControllerNamespace
()
?>
';
public function init()
{
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/generators/module/templates/view.php
View file @
6e538ac6
...
...
@@ -4,15 +4,15 @@
* @var yii\gii\generators\module\Generator $generator
*/
?>
<div
class=
"
<?=
$generator
->
moduleID
.
'-default-index'
;
?>
"
>
<h1>
<?=
"<?php"
;
?>
echo $this->context->action->uniqueId; ?>
</h1>
<div
class=
"
<?=
$generator
->
moduleID
.
'-default-index'
?>
"
>
<h1>
<?=
"<?php"
?>
echo $this->context->action->uniqueId; ?>
</h1>
<p>
This is the view content for action "
<?=
"<?php"
;
?>
echo $this->context->action->id; ?>".
The action belongs to the controller "
<?=
"<?php"
;
?>
echo get_class($this->context); ?>"
in the "
<?=
"<?php"
;
?>
echo $this->context->module->id; ?>" module.
This is the view content for action "
<?=
"<?php"
?>
echo $this->context->action->id; ?>".
The action belongs to the controller "
<?=
"<?php"
?>
echo get_class($this->context); ?>"
in the "
<?=
"<?php"
?>
echo $this->context->module->id; ?>" module.
</p>
<p>
You may customize this page by editing the following file:
<br>
<code>
<?=
"<?php"
;
?>
echo __FILE__; ?>
</code>
<code>
<?=
"<?php"
?>
echo __FILE__; ?>
</code>
</p>
</div>
This diff is collapsed.
Click to expand it.
framework/yii/gii/views/default/diff.php
View file @
6e538ac6
...
...
@@ -10,6 +10,6 @@
<?php
elseif
(
empty
(
$diff
))
:
?>
<div
class=
"alert alert-success"
>
Identical.
</div>
<?php
else
:
?>
<div
class=
"content"
>
<?=
$diff
;
?>
</div>
<div
class=
"content"
>
<?=
$diff
?>
</div>
<?php
endif
;
?>
</div>
This diff is collapsed.
Click to expand it.
framework/yii/gii/views/default/index.php
View file @
6e538ac6
...
...
@@ -21,9 +21,9 @@ $this->title = 'Welcome to Gii';
<div
class=
"row"
>
<?php
foreach
(
$generators
as
$id
=>
$generator
)
:
?>
<div
class=
"generator col-lg-4"
>
<h3>
<?=
Html
::
encode
(
$generator
->
getName
());
?>
</h3>
<p>
<?=
$generator
->
getDescription
();
?>
</p>
<p>
<?=
Html
::
a
(
'Start »'
,
[
'default/view'
,
'id'
=>
$id
],
[
'class'
=>
'btn btn-default'
]);
?>
</p>
<h3>
<?=
Html
::
encode
(
$generator
->
getName
())
?>
</h3>
<p>
<?=
$generator
->
getDescription
()
?>
</p>
<p>
<?=
Html
::
a
(
'Start »'
,
[
'default/view'
,
'id'
=>
$id
],
[
'class'
=>
'btn btn-default'
])
?>
</p>
</div>
<?php
endforeach
;
?>
</div>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/views/default/view.php
View file @
6e538ac6
...
...
@@ -24,9 +24,9 @@ foreach ($generator->templates as $name => $path) {
}
?>
<div
class=
"default-view"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
<?=
$generator
->
getDescription
();
?>
</p>
<p>
<?=
$generator
->
getDescription
()
?>
</p>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
"
$id
-generator"
,
...
...
@@ -45,10 +45,10 @@ foreach ($generator->templates as $name => $path) {
Please select which set of the templates should be used to generated the code.
'
);
?>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
'Preview'
,
[
'name'
=>
'preview'
,
'class'
=>
'btn btn-primary'
]);
?>
<?=
Html
::
submitButton
(
'Preview'
,
[
'name'
=>
'preview'
,
'class'
=>
'btn btn-primary'
])
?>
<?php
if
(
isset
(
$files
))
:
?>
<?=
Html
::
submitButton
(
'Generate'
,
[
'name'
=>
'generate'
,
'class'
=>
'btn btn-success'
]);
?>
<?=
Html
::
submitButton
(
'Generate'
,
[
'name'
=>
'generate'
,
'class'
=>
'btn btn-success'
])
?>
<?php
endif
;
?>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/views/default/view/files.php
View file @
6e538ac6
...
...
@@ -33,11 +33,11 @@ use yii\gii\CodeFile;
</thead>
<tbody>
<?php
foreach
(
$files
as
$file
)
:
?>
<tr
class=
"
<?=
$file
->
operation
;
?>
"
>
<tr
class=
"
<?=
$file
->
operation
?>
"
>
<td
class=
"file"
>
<?=
Html
::
a
(
Html
::
encode
(
$file
->
getRelativePath
()),
[
'preview'
,
'file'
=>
$file
->
id
],
[
'class'
=>
'preview-code'
,
'data-title'
=>
$file
->
getRelativePath
()]);
?>
<?=
Html
::
a
(
Html
::
encode
(
$file
->
getRelativePath
()),
[
'preview'
,
'file'
=>
$file
->
id
],
[
'class'
=>
'preview-code'
,
'data-title'
=>
$file
->
getRelativePath
()])
?>
<?php
if
(
$file
->
operation
===
CodeFile
::
OP_OVERWRITE
)
:
?>
<?=
Html
::
a
(
'diff'
,
[
'diff'
,
'file'
=>
$file
->
id
],
[
'class'
=>
'diff-code label label-warning'
,
'data-title'
=>
$file
->
getRelativePath
()]);
?>
<?=
Html
::
a
(
'diff'
,
[
'diff'
,
'file'
=>
$file
->
id
],
[
'class'
=>
'diff-code label label-warning'
,
'data-title'
=>
$file
->
getRelativePath
()])
?>
<?php
endif
;
?>
</td>
<td
class=
"action"
>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/gii/views/default/view/results.php
View file @
6e538ac6
...
...
@@ -18,5 +18,5 @@ use yii\gii\CodeFile;
echo
'<div class="alert alert-success">'
.
$generator
->
successMessage
()
.
'</div>'
;
}
?>
<pre>
<?=
nl2br
(
$results
);
?>
</pre>
<pre>
<?=
nl2br
(
$results
)
?>
</pre>
</div>
This diff is collapsed.
Click to expand it.
framework/yii/gii/views/layouts/generator.php
View file @
6e538ac6
...
...
@@ -25,7 +25,7 @@ $activeGenerator = Yii::$app->controller->generator;
</div>
</div>
<div
class=
"col-lg-9"
>
<?=
$content
;
?>
<?=
$content
?>
</div>
</div>
<?php
$this
->
endContent
();
?>
This diff is collapsed.
Click to expand it.
framework/yii/gii/views/layouts/main.php
View file @
6e538ac6
...
...
@@ -14,7 +14,7 @@ $asset = yii\gii\GiiAsset::register($this);
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
/>
<title>
<?=
Html
::
encode
(
$this
->
title
);
?>
</title>
<title>
<?=
Html
::
encode
(
$this
->
title
)
?>
</title>
<?php
$this
->
head
();
?>
</head>
<body>
...
...
@@ -37,13 +37,13 @@ NavBar::end();
?>
<div
class=
"container"
>
<?=
$content
;
?>
<?=
$content
?>
</div>
<footer
class=
"footer"
>
<div
class=
"container"
>
<p
class=
"pull-left"
>
A Product of
<a
href=
"http://www.yiisoft.com/"
>
Yii Software LLC
</a></p>
<p
class=
"pull-right"
>
<?=
Yii
::
powered
();
?>
</p>
<p
class=
"pull-right"
>
<?=
Yii
::
powered
()
?>
</p>
</div>
</footer>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/requirements/views/web/index.php
View file @
6e538ac6
...
...
@@ -52,18 +52,18 @@
<table
class=
"table table-bordered"
>
<tr><th>
Name
</th><th>
Result
</th><th>
Required By
</th><th>
Memo
</th></tr>
<?php
foreach
(
$requirements
as
$requirement
)
:
?>
<tr
class=
"
<?=
$requirement
[
'condition'
]
?
'success'
:
(
$requirement
[
'mandatory'
]
?
'error'
:
'warning'
);
?>
"
>
<tr
class=
"
<?=
$requirement
[
'condition'
]
?
'success'
:
(
$requirement
[
'mandatory'
]
?
'error'
:
'warning'
)
?>
"
>
<td>
<?=
$requirement
[
'name'
];
?>
<?=
$requirement
[
'name'
]
?>
</td>
<td>
<span
class=
"result"
>
<?=
$requirement
[
'condition'
]
?
'Passed'
:
(
$requirement
[
'mandatory'
]
?
'Failed'
:
'Warning'
);
?>
</span>
<span
class=
"result"
>
<?=
$requirement
[
'condition'
]
?
'Passed'
:
(
$requirement
[
'mandatory'
]
?
'Failed'
:
'Warning'
)
?>
</span>
</td>
<td>
<?=
$requirement
[
'by'
];
?>
<?=
$requirement
[
'by'
]
?>
</td>
<td>
<?=
$requirement
[
'memo'
];
?>
<?=
$requirement
[
'memo'
]
?>
</td>
</tr>
<?php
endforeach
;
?>
...
...
@@ -74,7 +74,7 @@
<hr>
<div
class=
"footer"
>
<p>
Server:
<?=
$this
->
getServerInfo
()
.
' '
.
$this
->
getNowDate
();
?>
</p>
<p>
Server:
<?=
$this
->
getServerInfo
()
.
' '
.
$this
->
getNowDate
()
?>
</p>
<p>
Powered by
<a
href=
"http://www.yiiframework.com/"
rel=
"external"
>
Yii Framework
</a></p>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/views/errorHandler/callStackItem.php
View file @
6e538ac6
...
...
@@ -12,15 +12,15 @@
*/
?>
<li
class=
"
<?php
if
(
!
$handler
->
isCoreFile
(
$file
)
||
$index
===
1
)
echo
'application'
;
?>
call-stack-item"
data-line=
"
<?=
(
int
)(
$line
-
$begin
);
?>
"
>
data-line=
"
<?=
(
int
)(
$line
-
$begin
)
?>
"
>
<div
class=
"element-wrap"
>
<div
class=
"element"
>
<span
class=
"item-number"
>
<?=
(
int
)
$index
;
?>
.
</span>
<span
class=
"item-number"
>
<?=
(
int
)
$index
?>
.
</span>
<span
class=
"text"
>
<?php
if
(
$file
!==
null
)
echo
'in '
.
$handler
->
htmlEncode
(
$file
);
?>
</span>
<?php
if
(
$method
!==
null
)
:
?>
<span
class=
"call"
>
<?php
if
(
$file
!==
null
)
echo
'–'
?>
<?php
if
(
$class
!==
null
)
echo
$handler
->
addTypeLinks
(
$class
)
.
'::'
;
?><?=
$handler
->
addTypeLinks
(
$method
.
'()'
);
?>
<?php
if
(
$class
!==
null
)
echo
$handler
->
addTypeLinks
(
$class
)
.
'::'
;
?><?=
$handler
->
addTypeLinks
(
$method
.
'()'
)
?>
</span>
<?php
endif
;
?>
<span
class=
"at"
>
<?php
if
(
$line
!==
null
)
echo
'at line'
;
?>
</span>
...
...
@@ -32,7 +32,7 @@
<div
class=
"error-line"
></div>
<?php
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
:
?>
<div
class=
"hover-line"
></div>
<?php
endfor
;
?>
<div
class=
"code"
>
<?php
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
:
?>
<span
class=
"lines-item"
>
<?=
(
int
)(
$i
+
1
);
?>
</span>
<?php
endfor
;
?>
<?php
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
:
?>
<span
class=
"lines-item"
>
<?=
(
int
)(
$i
+
1
)
?>
</span>
<?php
endfor
;
?>
<pre>
<?php
// fill empty lines with a whitespace to avoid rendering problems in opera
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
{
...
...
This diff is collapsed.
Click to expand it.
framework/yii/views/errorHandler/error.php
View file @
6e538ac6
...
...
@@ -28,7 +28,7 @@ if ($exception instanceof \yii\base\UserException) {
<html>
<head>
<meta
charset=
"utf-8"
/>
<title>
<?=
$handler
->
htmlEncode
(
$name
);
?>
</title>
<title>
<?=
$handler
->
htmlEncode
(
$name
)
?>
</title>
<style>
body
{
...
...
@@ -69,8 +69,8 @@ if ($exception instanceof \yii\base\UserException) {
</head>
<body>
<h1>
<?=
$handler
->
htmlEncode
(
$name
);
?>
</h1>
<h2>
<?=
nl2br
(
$handler
->
htmlEncode
(
$message
));
?>
</h2>
<h1>
<?=
$handler
->
htmlEncode
(
$name
)
?>
</h1>
<h2>
<?=
nl2br
(
$handler
->
htmlEncode
(
$message
))
?>
</h2>
<p>
The above error occurred while the Web server was processing your request.
</p>
...
...
@@ -78,7 +78,7 @@ if ($exception instanceof \yii\base\UserException) {
Please contact us if you think this is a server error. Thank you.
</p>
<div
class=
"version"
>
<?=
date
(
'Y-m-d H:i:s'
,
time
());
?>
<?=
date
(
'Y-m-d H:i:s'
,
time
())
?>
</div>
<?php
if
(
method_exists
(
$this
,
'endBody'
))
$this
->
endBody
();
// to allow injecting code into body (mostly by Yii Debug Toolbar) ?>
</
body
>
...
...
This diff is collapsed.
Click to expand it.
framework/yii/views/errorHandler/exception.php
View file @
6e538ac6
This diff is collapsed.
Click to expand it.
framework/yii/views/errorHandler/previousException.php
View file @
6e538ac6
...
...
@@ -9,13 +9,13 @@
<h2>
<span>
Caused by:
</span>
<?php
if
(
$exception
instanceof
\yii\base\Exception
)
:
?>
<span>
<?=
$handler
->
htmlEncode
(
$exception
->
getName
());
?>
</span>
–
<?=
$handler
->
addTypeLinks
(
get_class
(
$exception
));
?>
<span>
<?=
$handler
->
htmlEncode
(
$exception
->
getName
())
?>
</span>
–
<?=
$handler
->
addTypeLinks
(
get_class
(
$exception
))
?>
<?php
else
:
?>
<span>
<?=
$handler
->
htmlEncode
(
get_class
(
$exception
));
?>
</span>
<span>
<?=
$handler
->
htmlEncode
(
get_class
(
$exception
))
?>
</span>
<?php
endif
;
?>
</h2>
<h3>
<?=
$handler
->
htmlEncode
(
$exception
->
getMessage
());
?>
</h3>
<p>
in
<span
class=
"file"
>
<?=
$exception
->
getFile
();
?>
</span>
at line
<span
class=
"line"
>
<?=
$exception
->
getLine
();
?>
</span></p>
<?=
$handler
->
renderPreviousExceptions
(
$exception
);
?>
<h3>
<?=
$handler
->
htmlEncode
(
$exception
->
getMessage
())
?>
</h3>
<p>
in
<span
class=
"file"
>
<?=
$exception
->
getFile
()
?>
</span>
at line
<span
class=
"line"
>
<?=
$exception
->
getLine
()
?>
</span></p>
<?=
$handler
->
renderPreviousExceptions
(
$exception
)
?>
</div>
This diff is collapsed.
Click to expand it.
framework/yii/views/migration.php
View file @
6e538ac6
...
...
@@ -8,7 +8,7 @@
echo
"<?php
\n
"
;
?>
class
<?=
$className
;
?>
extends \yii\db\Migration
class
<?=
$className
?>
extends \yii\db\Migration
{
public function up()
{
...
...
@@ -17,7 +17,7 @@ class <?=$className; ?> extends \yii\db\Migration
public function down()
{
echo "
<?=
$className
;
?>
cannot be reverted.\n";
echo "
<?=
$className
?>
cannot be reverted.\n";
return false;
}
}
This diff is collapsed.
Click to expand it.
framework/yii/web/AssetBundle.php
View file @
6e538ac6
...
...
@@ -15,8 +15,9 @@ use yii\base\View;
/**
* AssetBundle represents a collection of asset files, such as CSS, JS, images.
*
* Each asset bundle has a unique name that globally identifies it among all asset bundles
* used in an application.
* Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application.
* The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php)
* of the class representing it.
*
* An asset bundle can depend on other asset bundles. When registering an asset bundle
* with a view, all its dependent asset bundles will be automatically registered.
...
...
@@ -130,13 +131,9 @@ class AssetBundle extends Object
/**
* Registers the CSS and JS files with the given view.
* It will then try to convert non-CSS or JS files (e.g. LESS, Sass) into the corresponding
* CSS or JS files using [[AssetManager::converter|asset converter]].
* @param \yii\base\View $view the view that the asset files to be registered with.
* @throws InvalidConfigException if [[baseUrl]] or [[basePath]] is not set when the bundle
* contains internal CSS or JS files.
* @param \yii\base\View $view the view that the asset files are to be registered with.
*/
public
function
registerAssets
(
$view
)
public
function
registerAsset
File
s
(
$view
)
{
foreach
(
$this
->
js
as
$js
)
{
if
(
strpos
(
$js
,
'/'
)
!==
0
&&
strpos
(
$js
,
'://'
)
===
false
)
{
...
...
@@ -156,6 +153,8 @@ class AssetBundle extends Object
/**
* Publishes the asset bundle if its source code is not under Web-accessible directory.
* It will also try to convert non-CSS or JS files (e.g. LESS, Sass) into the corresponding
* CSS or JS files using [[AssetManager::converter|asset converter]].
* @param AssetManager $am the asset manager to perform the asset publishing
* @throws InvalidConfigException if [[baseUrl]] or [[basePath]] is not set when the bundle
* contains internal CSS or JS files.
...
...
This diff is collapsed.
Click to expand it.
framework/yii/web/AssetManager.php
View file @
6e538ac6
...
...
@@ -95,10 +95,12 @@ class AssetManager extends Component
* it will treat `$name` as the class of the asset bundle and create a new instance of it.
*
* @param string $name the class name of the asset bundle
* @param boolean $publish whether to publish the asset files in the asset bundle before it is returned.
* If you set this false, you must manually call `AssetBundle::publish()` to publish the asset files.
* @return AssetBundle the asset bundle instance
* @throws InvalidConfigException if $name does not refer to a valid asset bundle
*/
public
function
getBundle
(
$name
)
public
function
getBundle
(
$name
,
$publish
=
true
)
{
if
(
isset
(
$this
->
bundles
[
$name
]))
{
if
(
$this
->
bundles
[
$name
]
instanceof
AssetBundle
)
{
...
...
@@ -111,8 +113,10 @@ class AssetManager extends Component
}
else
{
$bundle
=
Yii
::
createObject
(
$name
);
}
/** @var AssetBundle $bundle */
$bundle
->
publish
(
$this
);
if
(
$publish
)
{
/** @var AssetBundle $bundle */
$bundle
->
publish
(
$this
);
}
return
$this
->
bundles
[
$name
]
=
$bundle
;
}
...
...
This diff is collapsed.
Click to expand it.
framework/yii/web/User.php
View file @
6e538ac6
...
...
@@ -10,7 +10,6 @@ namespace yii\web;
use
Yii
;
use
yii\base\Component
;
use
yii\base\InvalidConfigException
;
use
yii\base\InvalidParamException
;
/**
* User is the class for the "user" application component that manages the user authentication status.
...
...
This diff is collapsed.
Click to expand it.
tests/unit/data/ar/Customer.php
View file @
6e538ac6
...
...
@@ -24,7 +24,7 @@ class Customer extends ActiveRecord
public
function
getOrders
()
{
return
$this
->
hasMany
(
'Order'
,
[
'customer_id'
=>
'id'
])
->
orderBy
(
'id'
);
return
$this
->
hasMany
(
Order
::
className
()
,
[
'customer_id'
=>
'id'
])
->
orderBy
(
'id'
);
}
public
static
function
active
(
$query
)
...
...
This diff is collapsed.
Click to expand it.
tests/unit/data/ar/Order.php
View file @
6e538ac6
...
...
@@ -19,17 +19,17 @@ class Order extends ActiveRecord
public
function
getCustomer
()
{
return
$this
->
hasOne
(
'Customer'
,
[
'id'
=>
'customer_id'
]);
return
$this
->
hasOne
(
Customer
::
className
()
,
[
'id'
=>
'customer_id'
]);
}
public
function
getOrderItems
()
{
return
$this
->
hasMany
(
'OrderItem'
,
[
'order_id'
=>
'id'
]);
return
$this
->
hasMany
(
OrderItem
::
className
()
,
[
'order_id'
=>
'id'
]);
}
public
function
getItems
()
{
return
$this
->
hasMany
(
'Item'
,
[
'id'
=>
'item_id'
])
return
$this
->
hasMany
(
Item
::
className
()
,
[
'id'
=>
'item_id'
])
->
via
(
'orderItems'
,
function
(
$q
)
{
// additional query configuration
})
->
orderBy
(
'id'
);
...
...
@@ -37,7 +37,7 @@ class Order extends ActiveRecord
public
function
getBooks
()
{
return
$this
->
hasMany
(
'Item'
,
[
'id'
=>
'item_id'
])
return
$this
->
hasMany
(
Item
::
className
()
,
[
'id'
=>
'item_id'
])
->
viaTable
(
'tbl_order_item'
,
[
'order_id'
=>
'id'
])
->
where
([
'category_id'
=>
1
]);
}
...
...
This diff is collapsed.
Click to expand it.
tests/unit/data/ar/OrderItem.php
View file @
6e538ac6
...
...
@@ -19,11 +19,11 @@ class OrderItem extends ActiveRecord
public
function
getOrder
()
{
return
$this
->
hasOne
(
'Order'
,
[
'id'
=>
'order_id'
]);
return
$this
->
hasOne
(
Order
::
className
()
,
[
'id'
=>
'order_id'
]);
}
public
function
getItem
()
{
return
$this
->
hasOne
(
'Item'
,
[
'id'
=>
'item_id'
]);
return
$this
->
hasOne
(
Item
::
className
()
,
[
'id'
=>
'item_id'
]);
}
}
This diff is collapsed.
Click to expand it.
tests/unit/data/views/layout.php
View file @
6e538ac6
...
...
@@ -14,7 +14,7 @@
<body>
<?php
$this
->
beginBody
();
?>
<?=
$content
;
?>
<?=
$content
?>
<?php
$this
->
endBody
();
?>
</body>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment