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
ea4cd9c5
Commit
ea4cd9c5
authored
Jul 22, 2011
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
w
parent
c80c9dec
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
20 deletions
+21
-20
YiiBase.php
framework/YiiBase.php
+1
-1
Component.php
framework/base/Component.php
+12
-11
Dictionary.php
framework/base/Dictionary.php
+1
-1
Model.php
framework/base/Model.php
+6
-6
Vector.php
framework/base/Vector.php
+1
-1
No files found.
framework/YiiBase.php
View file @
ea4cd9c5
...
@@ -304,7 +304,7 @@ class YiiBase
...
@@ -304,7 +304,7 @@ class YiiBase
* Any additional parameters passed to this method will be
* Any additional parameters passed to this method will be
* passed to the constructor of the object being created.
* passed to the constructor of the object being created.
*
*
* ~~~
php
* ~~~
* $component = Yii::createComponent('@app/components/GoogleMap');
* $component = Yii::createComponent('@app/components/GoogleMap');
* $component = Yii::createComponent('\application\components\GoogleMap');
* $component = Yii::createComponent('\application\components\GoogleMap');
* $component = Yii::createComponent(array(
* $component = Yii::createComponent(array(
...
...
framework/base/Component.php
View file @
ea4cd9c5
...
@@ -18,7 +18,7 @@ namespace yii\base;
...
@@ -18,7 +18,7 @@ namespace yii\base;
* and/or a setter method (e.g. `setLabel`). For example, the following
* and/or a setter method (e.g. `setLabel`). For example, the following
* getter and setter methods define a property named `label`:
* getter and setter methods define a property named `label`:
*
*
* ~~~
php
* ~~~
* private $_label;
* private $_label;
*
*
* public function getLabel()
* public function getLabel()
...
@@ -36,7 +36,7 @@ namespace yii\base;
...
@@ -36,7 +36,7 @@ namespace yii\base;
* Reading or writing a property will cause the invocation of the corresponding
* Reading or writing a property will cause the invocation of the corresponding
* getter or setter method. For example,
* getter or setter method. For example,
*
*
* ~~~
php
* ~~~
* // equivalent to $label = $component->getLabel();
* // equivalent to $label = $component->getLabel();
* $label = $component->label;
* $label = $component->label;
* // equivalent to $component->setLabel('abc');
* // equivalent to $component->setLabel('abc');
...
@@ -49,7 +49,7 @@ namespace yii\base;
...
@@ -49,7 +49,7 @@ namespace yii\base;
* (called *event handlers*) attached to the event will be invoked automatically.
* (called *event handlers*) attached to the event will be invoked automatically.
* The `on` method is typically declared like the following:
* The `on` method is typically declared like the following:
*
*
* ~~~
php
* ~~~
* public function onClick($event)
* public function onClick($event)
* {
* {
* $this->raiseEvent('onClick', $event);
* $this->raiseEvent('onClick', $event);
...
@@ -63,7 +63,7 @@ namespace yii\base;
...
@@ -63,7 +63,7 @@ namespace yii\base;
*
*
* An event handler should be defined with the following signature:
* An event handler should be defined with the following signature:
*
*
* ~~~
php
* ~~~
* public function foo($event) { ... }
* public function foo($event) { ... }
* ~~~
* ~~~
*
*
...
@@ -72,14 +72,14 @@ namespace yii\base;
...
@@ -72,14 +72,14 @@ namespace yii\base;
* To attach an event handler to an event, call [[attachEventHandler]].
* To attach an event handler to an event, call [[attachEventHandler]].
* Alternatively, you can also do the following:
* Alternatively, you can also do the following:
*
*
* ~~~
php
* ~~~
* $component->onClick = $callback;
* $component->onClick = $callback;
* // or $component->onClick->add($callback);
* // or $component->onClick->add($callback);
* ~~~
* ~~~
*
*
* where `$callback` refers to a valid PHP callback. Some examples of `$callback` are:
* where `$callback` refers to a valid PHP callback. Some examples of `$callback` are:
*
*
* ~~~
php
* ~~~
* 'handleOnClick' // handleOnClick() is a global function
* 'handleOnClick' // handleOnClick() is a global function
* array($object, 'handleOnClick') // $object->handleOnClick()
* array($object, 'handleOnClick') // $object->handleOnClick()
* array('Page', 'handleOnClick') // Page::handleOnClick()
* array('Page', 'handleOnClick') // Page::handleOnClick()
...
@@ -375,9 +375,10 @@ class Component
...
@@ -375,9 +375,10 @@ class Component
* You may manipulate the returned [[Vector]] object by adding or removing handlers.
* You may manipulate the returned [[Vector]] object by adding or removing handlers.
* For example,
* For example,
*
*
* ~~~
php
* ~~~
* $component->getEventHandlers($eventName)->insertAt(0, $eventHandler);
* $component->getEventHandlers($eventName)->insertAt(0, $eventHandler);
* ~~~
* ~~~
*
* @param string $name the event name
* @param string $name the event name
* @return Vector list of attached event handlers for the event
* @return Vector list of attached event handlers for the event
* @throws Exception if the event is not defined
* @throws Exception if the event is not defined
...
@@ -399,14 +400,14 @@ class Component
...
@@ -399,14 +400,14 @@ class Component
*
*
* This is equivalent to the following code:
* This is equivalent to the following code:
*
*
* ~~~
php
* ~~~
* $component->getEventHandlers($eventName)->add($eventHandler);
* $component->getEventHandlers($eventName)->add($eventHandler);
* ~~~
* ~~~
*
*
* An event handler must be a valid PHP callback. The followings are
* An event handler must be a valid PHP callback. The followings are
* some examples:
* some examples:
*
*
* ~~~
php
* ~~~
* 'handleOnClick' // handleOnClick() is a global function
* 'handleOnClick' // handleOnClick() is a global function
* array($object, 'handleOnClick') // $object->handleOnClick()
* array($object, 'handleOnClick') // $object->handleOnClick()
* array('Page', 'handleOnClick') // Page::handleOnClick()
* array('Page', 'handleOnClick') // Page::handleOnClick()
...
@@ -415,7 +416,7 @@ class Component
...
@@ -415,7 +416,7 @@ class Component
*
*
* An event handler must be defined with the following signature,
* An event handler must be defined with the following signature,
*
*
* ~~~
php
* ~~~
* function handlerName($event) {}
* function handlerName($event) {}
* ~~~
* ~~~
*
*
...
@@ -624,7 +625,7 @@ class Component
...
@@ -624,7 +625,7 @@ class Component
*
*
* If a PHP callback is used, the corresponding function/method signature should be
* If a PHP callback is used, the corresponding function/method signature should be
*
*
* ~~~
php
* ~~~
* function foo($param1, $param2, ..., $component) { ... }
* function foo($param1, $param2, ..., $component) { ... }
* ~~~
* ~~~
*
*
...
...
framework/base/Dictionary.php
View file @
ea4cd9c5
...
@@ -20,7 +20,7 @@ namespace yii\base;
...
@@ -20,7 +20,7 @@ namespace yii\base;
* Because Dictionary implements a set of SPL interfaces, it can be used
* Because Dictionary implements a set of SPL interfaces, it can be used
* like a regular PHP array as follows,
* like a regular PHP array as follows,
*
*
* ~~~
php
* ~~~
* $dictionary[$key] = $value; // add a key-value pair
* $dictionary[$key] = $value; // add a key-value pair
* unset($dictionary[$key]); // remove the value with the specified key
* unset($dictionary[$key]); // remove the value with the specified key
* if (isset($dictionary[$key])) // if the dictionary contains the key
* if (isset($dictionary[$key])) // if the dictionary contains the key
...
...
framework/base/Model.php
View file @
ea4cd9c5
...
@@ -78,7 +78,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
...
@@ -78,7 +78,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
*
*
* Each rule is an array with the following structure:
* Each rule is an array with the following structure:
*
*
* ~~~
php
* ~~~
* array(
* array(
* 'attribute list',
* 'attribute list',
* 'validator type',
* 'validator type',
...
@@ -100,7 +100,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
...
@@ -100,7 +100,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
* A validator can be either a model class method or an object.
* A validator can be either a model class method or an object.
* If the former, the method must have the following signature:
* If the former, the method must have the following signature:
*
*
* ~~~
php
* ~~~
* // $params refers to validation parameters given in the rule
* // $params refers to validation parameters given in the rule
* function validatorName($attribute, $params)
* function validatorName($attribute, $params)
* ~~~
* ~~~
...
@@ -111,7 +111,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
...
@@ -111,7 +111,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
*
*
* The following are some examples:
* The following are some examples:
*
*
* ~~~
php
* ~~~
* array(
* array(
* array('username', 'required'),
* array('username', 'required'),
* array('username', 'length', 'min'=>3, 'max'=>12),
* array('username', 'length', 'min'=>3, 'max'=>12),
...
@@ -136,7 +136,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
...
@@ -136,7 +136,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
* behavior names. Each behavior configuration can be either a string specifying
* behavior names. Each behavior configuration can be either a string specifying
* the behavior class or an array of the following structure:
* the behavior class or an array of the following structure:
*
*
* ~~~
php
* ~~~
* 'behaviorName' => array(
* 'behaviorName' => array(
* 'class' => 'BehaviorClass',
* 'class' => 'BehaviorClass',
* 'property1' => 'value1',
* 'property1' => 'value1',
...
@@ -295,7 +295,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
...
@@ -295,7 +295,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
* manipulate it by inserting or removing validators (useful in model behaviors).
* manipulate it by inserting or removing validators (useful in model behaviors).
* For example,
* For example,
*
*
* ~~~
php
* ~~~
* $model->validators->add($newValidator);
* $model->validators->add($newValidator);
* ~~~
* ~~~
*
*
...
@@ -412,7 +412,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
...
@@ -412,7 +412,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
* @return array errors for all attributes or the specified attribute. Empty array is returned if no error.
* @return array errors for all attributes or the specified attribute. Empty array is returned if no error.
* Note that when returning errors for all attributes, the result is a two-dimensional array, like the following:
* Note that when returning errors for all attributes, the result is a two-dimensional array, like the following:
*
*
* ~~~
php
* ~~~
* array(
* array(
* 'username' => array(
* 'username' => array(
* 'Username is required.',
* 'Username is required.',
...
...
framework/base/Vector.php
View file @
ea4cd9c5
...
@@ -21,7 +21,7 @@ namespace yii\base;
...
@@ -21,7 +21,7 @@ namespace yii\base;
* Because Vector implements a set of SPL interfaces, it can be used
* Because Vector implements a set of SPL interfaces, it can be used
* like a regular PHP array as follows,
* like a regular PHP array as follows,
*
*
* ~~~
php
* ~~~
* $vector[] = $item; // append new item at the end
* $vector[] = $item; // append new item at the end
* $vector[$index] = $item; // set new item at $index
* $vector[$index] = $item; // set new item at $index
* unset($vector[$index]); // remove the item at $index
* unset($vector[$index]); // remove the item at $index
...
...
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