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
292622f9
Commit
292622f9
authored
Jun 06, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small guide improvements
parent
44476d98
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
structure-models.md
docs/guide/structure-models.md
+4
-1
No files found.
docs/guide/structure-models.md
View file @
292622f9
...
...
@@ -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.
> 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>
...
...
@@ -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
]
].
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
namespace
app\models
;
...
...
@@ -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.
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
...
...
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