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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
919615e5
Commit
919615e5
authored
Mar 12, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed references in the guide
parent
f944278a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
23 deletions
+27
-23
console.md
docs/guide/console.md
+1
-1
data-grid.md
docs/guide/data-grid.md
+4
-4
data-providers.md
docs/guide/data-providers.md
+14
-10
data-widgets.md
docs/guide/data-widgets.md
+3
-3
model.md
docs/guide/model.md
+4
-4
rest.md
docs/guide/rest.md
+1
-1
No files found.
docs/guide/console.md
View file @
919615e5
...
...
@@ -97,7 +97,7 @@ If a route does not contain an action ID, the default action will be executed.
### Options
By overriding the
[
[yii\console\Controller::options(
$id
)
]
] method, you can specify options that are available
By overriding the
[
[yii\console\Controller::options()
]
] method, you can specify options that are available
to a console command (controller/actionID). The method should return a list of public property names of the controller class.
When running a command, you may specify the value of an option using the syntax
`--OptionName=OptionValue`
.
This will assign
`OptionValue`
to the
`OptionName`
property of the controller class.
...
...
docs/guide/data-grid.md
View file @
919615e5
...
...
@@ -125,7 +125,7 @@ Available properties you can configure are:
controller.
-
`template`
the template used for composing each cell in the action column. Tokens enclosed within curly brackets are
treated as controller action IDs (also called
*button names*
in the context of action column). They will be replaced
by the corresponding button rendering callbacks specified in
[
[buttons
]
]. For example, the token
`{view}`
will be
by the corresponding button rendering callbacks specified in
[
[
yii\grid\ActionColumn::$buttons|
buttons
]
]. For example, the token
`{view}`
will be
replaced by the result of the callback
`buttons['view']`
. If a callback cannot be found, the token will be replaced
with an empty string. Default is
`{view} {update} {delete}`
.
-
`buttons`
is an array of button rendering callbacks. The array keys are the button names (without curly brackets),
...
...
@@ -141,14 +141,14 @@ In the code above `$url` is the URL that the column creates for the button, and
rendered for the current row.
-
`urlCreator`
is a callback that creates a button URL using the specified model information. The signature of
the callback should be the same as that of
[
[
createUrl()
]
]. If this property is not set, button URLs will be created
using
[
[
createUrl()
]
].
the callback should be the same as that of
[
[
yii\grid\ActionColumn\createUrl()
]
]. If this property is not set,
button URLs will be created using
[
[yii\grid\ActionColumn\
createUrl()
]
].
#### Checkbox column
CheckboxColumn displays a column of checkboxes.
To add a CheckboxColumn to the
[
[
GridView
]
], add it to the
[
[GridView::
columns|columns
]
] configuration as follows:
To add a CheckboxColumn to the
[
[
yii\grid\GridView
]
], add it to the
[
[yii\grid\GridView::$
columns|columns
]
] configuration as follows:
```
php
echo
GridView
::
widget
([
...
...
docs/guide/data-providers.md
View file @
919615e5
...
...
@@ -46,18 +46,18 @@ Array data provider
ArrayDataProvider implements a data provider based on a data array.
The [[allModels]] property contains all data models that may be sorted and/or paginated.
The [[
yii\data\ArrayDataProvider::$
allModels]] property contains all data models that may be sorted and/or paginated.
ArrayDataProvider will provide the data after sorting and/or pagination.
You may configure the [[
sort]] and [[
pagination]] properties to
You may configure the [[
yii\data\ArrayDataProvider::$sort]] and [[yii\data\ArrayDataProvider::$
pagination]] properties to
customize the sorting and pagination behaviors.
Elements in the [[allModels]] array may be either objects (e.g. model objects)
Elements in the [[
yii\data\ArrayDataProvider::$
allModels]] array may be either objects (e.g. model objects)
or associative arrays (e.g. query results of DAO).
Make sure to set the [[key]] property to the name of the field that uniquely
Make sure to set the [[
yii\data\ArrayDataProvider::$
key]] property to the name of the field that uniquely
identifies a data record or false if you do not have such a field.
Compared to `ActiveDataProvider`, `ArrayDataProvider` could be less efficient
because it needs to have [[allModels]] ready.
because it needs to have [[
yii\data\ArrayDataProvider::$
allModels]] ready.
ArrayDataProvider may be used in the following way:
...
...
@@ -86,8 +86,9 @@ SqlDataProvider implements a data provider based on a plain SQL statement. It pr
representing a row of query result.
Like other data providers, SqlDataProvider also supports sorting and pagination. It does so by modifying the given
[[sql]] statement with "ORDER BY" and "LIMIT" clauses. You may configure the [[sort]] and [[pagination]] properties to
customize sorting and pagination behaviors.
[[yii\data\SqlDataProvider::$sql]] statement with "ORDER BY" and "LIMIT" clauses. You may configure the
[[yii\data\SqlDataProvider::$sort]] and [[yii\data\SqlDataProvider::$pagination]] properties to customize sorting
and pagination behaviors.
`SqlDataProvider` may be used in the following way:
...
...
@@ -120,11 +121,13 @@ $dataProvider = new SqlDataProvider([
$models = $dataProvider->getModels();
```
> Note: if you want to use the pagination feature, you must configure the [[totalCount]] property
to be the total number of rows (without pagination). And if you want to use the sorting feature,
you must configure the
[
[sort
]
] property so that the provider knows which columns can be sorted.
> Note: if you want to use the pagination feature, you must configure the [[yii\data\SqlDataProvider::$totalCount]]
property to be the total number of rows (without pagination). And if you want to use the sorting feature,
you must configure the
[
[yii\data\SqlDataProvider::$sort
]
] property so that the provider knows which columns can
be sorted.
Implementing your own custom data provider
------------------------------------------
TBD
\ No newline at end of file
docs/guide/data-widgets.md
View file @
919615e5
...
...
@@ -9,12 +9,12 @@ ListView
DetailView
----------
DetailView displays the detail of a single data
[
[model
]
].
DetailView displays the detail of a single data
[
[
yii\widgets\DetailView::$model|
model
]
].
It is best used for displaying a model in a regular format (e.g. each model attribute is displayed as a row in a table).
The model can be either an instance of
[
[Model
]
] or an associative array.
The model can be either an instance of
[
[
\yii\base\
Model
]
] or an associative array.
DetailView uses the
[
[attributes
]
] property to determines which model attributes should be displayed and how they
DetailView uses the
[
[
yii\widgets\DetailView::$
attributes
]
] property to determines which model attributes should be displayed and how they
should be formatted.
A typical usage of DetailView is as follows:
...
...
docs/guide/model.md
View file @
919615e5
...
...
@@ -226,8 +226,8 @@ When `validate()` is called, the actual validation rules executed are determined
### Creating your own validators (Inline validators)
If none of the built in validators fit your needs, you can create your own validator by creating a method in you model class.
This method will be wrapped by an
[
[
InlineValidator|yii\validators\
InlineValidator
]
] an be called upon validation.
You will do the validation of the attribute and
[
[
add errors|yii\base\Model::addError()
]
] to the model when validation fails.
This method will be wrapped by an
[
[
yii\validators\InlineValidator|
InlineValidator
]
] an be called upon validation.
You will do the validation of the attribute and
[
[
yii\base\Model::addError()|add errors
]
] to the model when validation fails.
The method has the following signature
`public function myValidator($attribute, $params)`
while you are free to choose the name.
...
...
@@ -251,8 +251,8 @@ public function rules()
}
```
You may also set other properties of the
[
[
InlineValidator|yii\validators\
InlineValidator
]
] in the rules definition,
for example the
[
[
skipOnEmpty|yii\validators\InlineValidator::
skipOnEmpty
]
] property:
You may also set other properties of the
[
[
yii\validators\InlineValidator|
InlineValidator
]
] in the rules definition,
for example the
[
[
yii\validators\InlineValidator::$skipOnEmpty|
skipOnEmpty
]
] property:
```
php
[[
'birthdate'
],
'validateAge'
,
'params'
=>
[
'min'
=>
'12'
],
'skipOnEmpty'
=>
false
],
...
...
docs/guide/rest.md
View file @
919615e5
...
...
@@ -198,7 +198,7 @@ Step 2 is usually a very mechanical data conversion process and can be well hand
Step 1 involves some major development effort as explained below.
When the
[
[yii\rest\Serializer|serializer
]
] converts an object into an array, it will call the
`toArray()`
method
of the object if it implements
[
[yii\base\Arrayable
Interface
]
]. If an object does not implement this interface,
of the object if it implements
[
[yii\base\Arrayable
]
]. If an object does not implement this interface,
its public properties will be returned instead.
For classes extending from
[
[yii\base\Model
]
] or
[
[yii\db\ActiveRecord
]
], besides directly overriding
`toArray()`
,
...
...
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