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
e700ca0a
Commit
e700ca0a
authored
Nov 21, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more on yii basics
parent
bcfb1eaf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
basics.md
docs/guide/basics.md
+11
-13
events.md
docs/guide/events.md
+1
-0
No files found.
docs/guide/basics.md
View file @
e700ca0a
...
@@ -5,21 +5,21 @@ Basic concepts of Yii
...
@@ -5,21 +5,21 @@ Basic concepts of Yii
Component and Object
Component and Object
--------------------
--------------------
Yii 2.0 breaks the
`CComponent`
class in 1.1 into two classes:
`Object`
and
`Component`
.
Classes of the Yii framework usually extend from one of the two base classes
[
[Object
]
] and
[
[Component
]
].
The
`Object`
class is a lightweight base class that allows defining class properties
These classes provide useful features that are added automatically to all classes extending from them.
via getters and setters. The
`Component`
class extends from
`Object`
and supports
the event feature and the behavior feature.
If your class does not need the event or behavior feature, you should consider using
The
`Object`
class provides the
[
configuration and property feature
](
../api/base/Object.md
)
.
`Object`
as the base class. This is usually the case for classes that represent basic
The
`Component`
class extends from
`Object`
and adds
[
event handling
](
events.md
)
and
[
behaviors
](
behaviors.md
)
.
data structures.
`Object`
is usually used for classes that represent basic data structures while
`Component`
is used for
application components and other classes that implement higher logic.
Object Configuration
Object Configuration
--------------------
--------------------
The
`Object`
class introduces a uniform way of configuring objects. Any descendant class
The
[
[Object
]
]
class introduces a uniform way of configuring objects. Any descendant class
of
`Object`
should declare its constructor (if needed) in the following way so that
of
[
[Object
]
]
should declare its constructor (if needed) in the following way so that
it can be properly configured:
it can be properly configured:
```
php
```
php
...
@@ -57,11 +57,9 @@ $object = Yii::createObject([
...
@@ -57,11 +57,9 @@ $object = Yii::createObject([
],
$param1
,
$param2
);
],
$param1
,
$param2
);
```
```
More on configuration in
[
configuration
](
configuration.md
)
Path Alias
Path Alias
es
----------
----------
--
Yii 2.0 expands the usage of path aliases to both file/directory paths and URLs. An alias
Yii 2.0 expands the usage of path aliases to both file/directory paths and URLs. An alias
must start with a
`@`
character so that it can be differentiated from file/directory paths and URLs.
must start with a
`@`
character so that it can be differentiated from file/directory paths and URLs.
...
...
docs/guide/events.md
View file @
e700ca0a
Events
Events
======
======
TBD, see also
[
Component.md
](
../api/base/Component.md
)
.
There is no longer the need to define an
`on`
-method in order to define an event in Yii 2.0.
There is no longer the need to define an
`on`
-method in order to define an event in Yii 2.0.
Instead, you can use whatever event names. To attach a handler to an event, you should
Instead, you can use whatever event names. To attach a handler to an event, you should
...
...
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