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
ce70a4e0
Commit
ce70a4e0
authored
Jun 06, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:yiisoft/yii2
parents
e67ca1a6
292622f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
structure-models.md
docs/guide/structure-models.md
+4
-1
BaseConsole.php
framework/helpers/BaseConsole.php
+1
-1
No files found.
docs/guide/structure-models.md
View file @
ce70a4e0
...
@@ -18,7 +18,7 @@ The `Model` class is also the base class for more advanced models, such as [Acti
...
@@ -18,7 +18,7 @@ The `Model` class is also the base class for more advanced models, such as [Acti
Please refer to the relevant documentation for more details about these advanced models.
Please refer to the relevant documentation for more details about these advanced models.
> Info: You are not required to base your model classes on [[yii\base\Model]]. However, because there are many Yii
> Info: You are not required to base your model classes on [[yii\base\Model]]. However, because there are many Yii
components built to support
[
[yii\base\Model
]
], it is usually the preferable base
model classes
.
components built to support
[
[yii\base\Model
]
], it is usually the preferable base
class for a model
.
## Attributes <a name="attributes"></a>
## Attributes <a name="attributes"></a>
...
@@ -27,6 +27,7 @@ Attributes are the properties that represent business data. By default, attribut
...
@@ -27,6 +27,7 @@ Attributes are the properties that represent business data. By default, attribut
member variables if your model class extends directly from
[
[yii\base\Model
]
].
member variables if your model class extends directly from
[
[yii\base\Model
]
].
The following code creates a
`ContactForm`
model class with four attributes:
`name`
,
`email`
,
`subject`
and
`body`
.
The following code creates a
`ContactForm`
model class with four attributes:
`name`
,
`email`
,
`subject`
and
`body`
.
This model represents the input data that is received from an HTML form.
```
php
```
php
namespace
app\models
;
namespace
app\models
;
...
@@ -67,6 +68,8 @@ foreach ($model as $name => $value) {
...
@@ -67,6 +68,8 @@ foreach ($model as $name => $value) {
}
}
```
```
### Extending model attributes
The method
[
[yii\base\Model::attributes()
]
] defines and returns the names of the attributes in a model.
The method
[
[yii\base\Model::attributes()
]
] defines and returns the names of the attributes in a model.
You may override this method to support different ways of defining attributes. For example,
[
[yii\db\ActiveRecord
]
]
You may override this method to support different ways of defining attributes. For example,
[
[yii\db\ActiveRecord
]
]
does so by returning table column names as attribute names. Note that you may also need to override the magic
does so by returning table column names as attribute names. Note that you may also need to override the magic
...
...
framework/helpers/BaseConsole.php
View file @
ce70a4e0
...
@@ -780,7 +780,7 @@ class BaseConsole
...
@@ -780,7 +780,7 @@ class BaseConsole
}
}
static
::
output
(
" ? - Show help"
);
static
::
output
(
" ? - Show help"
);
goto
top
;
goto
top
;
}
elseif
(
!
in_array
(
$input
,
array_keys
(
$options
)
))
{
}
elseif
(
!
array_key_exists
(
$input
,
$options
))
{
goto
top
;
goto
top
;
}
}
...
...
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