Browse Source

w

tags/2.0.0-alpha
Qiang Xue 13 years ago
parent
commit
ea4cd9c5bd
  1. 2
      framework/YiiBase.php
  2. 23
      framework/base/Component.php
  3. 2
      framework/base/Dictionary.php
  4. 12
      framework/base/Model.php
  5. 2
      framework/base/Vector.php

2
framework/YiiBase.php

@ -304,7 +304,7 @@ class YiiBase
* Any additional parameters passed to this method will be
* passed to the constructor of the object being created.
*
* ~~~php
* ~~~
* $component = Yii::createComponent('@app/components/GoogleMap');
* $component = Yii::createComponent('\application\components\GoogleMap');
* $component = Yii::createComponent(array(

23
framework/base/Component.php

@ -18,7 +18,7 @@ namespace yii\base;
* and/or a setter method (e.g. `setLabel`). For example, the following
* getter and setter methods define a property named `label`:
*
* ~~~php
* ~~~
* private $_label;
*
* public function getLabel()
@ -36,7 +36,7 @@ namespace yii\base;
* Reading or writing a property will cause the invocation of the corresponding
* getter or setter method. For example,
*
* ~~~php
* ~~~
* // equivalent to $label = $component->getLabel();
* $label = $component->label;
* // equivalent to $component->setLabel('abc');
@ -49,7 +49,7 @@ namespace yii\base;
* (called *event handlers*) attached to the event will be invoked automatically.
* The `on` method is typically declared like the following:
*
* ~~~php
* ~~~
* public function onClick($event)
* {
* $this->raiseEvent('onClick', $event);
@ -63,7 +63,7 @@ namespace yii\base;
*
* An event handler should be defined with the following signature:
*
* ~~~php
* ~~~
* public function foo($event) { ... }
* ~~~
*
@ -72,14 +72,14 @@ namespace yii\base;
* To attach an event handler to an event, call [[attachEventHandler]].
* Alternatively, you can also do the following:
*
* ~~~php
* ~~~
* $component->onClick = $callback;
* // or $component->onClick->add($callback);
* ~~~
*
* where `$callback` refers to a valid PHP callback. Some examples of `$callback` are:
*
* ~~~php
* ~~~
* 'handleOnClick' // handleOnClick() is a global function
* array($object, 'handleOnClick') // $object->handleOnClick()
* array('Page', 'handleOnClick') // Page::handleOnClick()
@ -375,9 +375,10 @@ class Component
* You may manipulate the returned [[Vector]] object by adding or removing handlers.
* For example,
*
* ~~~php
* ~~~
* $component->getEventHandlers($eventName)->insertAt(0, $eventHandler);
* ~~~
*
* @param string $name the event name
* @return Vector list of attached event handlers for the event
* @throws Exception if the event is not defined
@ -399,14 +400,14 @@ class Component
*
* This is equivalent to the following code:
*
* ~~~php
* ~~~
* $component->getEventHandlers($eventName)->add($eventHandler);
* ~~~
*
* An event handler must be a valid PHP callback. The followings are
* some examples:
*
* ~~~php
* ~~~
* 'handleOnClick' // handleOnClick() is a global function
* array($object, 'handleOnClick') // $object->handleOnClick()
* array('Page', 'handleOnClick') // Page::handleOnClick()
@ -415,7 +416,7 @@ class Component
*
* An event handler must be defined with the following signature,
*
* ~~~php
* ~~~
* function handlerName($event) {}
* ~~~
*
@ -624,7 +625,7 @@ class Component
*
* If a PHP callback is used, the corresponding function/method signature should be
*
* ~~~php
* ~~~
* function foo($param1, $param2, ..., $component) { ... }
* ~~~
*

2
framework/base/Dictionary.php

@ -20,7 +20,7 @@ namespace yii\base;
* Because Dictionary implements a set of SPL interfaces, it can be used
* like a regular PHP array as follows,
*
* ~~~php
* ~~~
* $dictionary[$key] = $value; // add a key-value pair
* unset($dictionary[$key]); // remove the value with the specified key
* if (isset($dictionary[$key])) // if the dictionary contains the key

12
framework/base/Model.php

@ -78,7 +78,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
*
* Each rule is an array with the following structure:
*
* ~~~php
* ~~~
* array(
* 'attribute list',
* 'validator type',
@ -100,7 +100,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
* A validator can be either a model class method or an object.
* If the former, the method must have the following signature:
*
* ~~~php
* ~~~
* // $params refers to validation parameters given in the rule
* function validatorName($attribute, $params)
* ~~~
@ -111,7 +111,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
*
* The following are some examples:
*
* ~~~php
* ~~~
* array(
* array('username', 'required'),
* array('username', 'length', 'min'=>3, 'max'=>12),
@ -136,7 +136,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
* behavior names. Each behavior configuration can be either a string specifying
* the behavior class or an array of the following structure:
*
* ~~~php
* ~~~
* 'behaviorName' => array(
* 'class' => 'BehaviorClass',
* 'property1' => 'value1',
@ -295,7 +295,7 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
* manipulate it by inserting or removing validators (useful in model behaviors).
* For example,
*
* ~~~php
* ~~~
* $model->validators->add($newValidator);
* ~~~
*
@ -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.
* Note that when returning errors for all attributes, the result is a two-dimensional array, like the following:
*
* ~~~php
* ~~~
* array(
* 'username' => array(
* 'Username is required.',

2
framework/base/Vector.php

@ -21,7 +21,7 @@ namespace yii\base;
* Because Vector implements a set of SPL interfaces, it can be used
* like a regular PHP array as follows,
*
* ~~~php
* ~~~
* $vector[] = $item; // append new item at the end
* $vector[$index] = $item; // set new item at $index
* unset($vector[$index]); // remove the item at $index

Loading…
Cancel
Save