diff --git a/CHANGELOG b/CHANGELOG
index dab187e14..bcfe27d56 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -32,6 +32,7 @@ Version 1.1.7 to be released
- Enh: Added CGridView::ajaxUpdateError for the possibility to use a custom ajax error handler (mdomba)
- Enh: Allowed using CController instead of Controller with webapp generated application (Sam Dark)
- Enh: Added CController::createInlineAction, CInlineAction::inputParams and errorMessage to allow easier override (Qiang)
+- Enh: Chained calls are now possible for most framework class setters and methods not returning a value (Sam Dark)
- Chg #2001: CGridView now renders footer after the body content (Qiang)
- Chg: Upgraded jQuery to version 1.5 (Sam Dark)
- Chg: Upgraded jQuery UI to version 1.8.9 (Sam Dark)
diff --git a/framework/base/CApplication.php b/framework/base/CApplication.php
index d848a36a0..ab4b8bda1 100644
--- a/framework/base/CApplication.php
+++ b/framework/base/CApplication.php
@@ -210,10 +210,12 @@ abstract class CApplication extends CModule
/**
* Sets the unique identifier for the application.
* @param string $id the unique identifier for the application.
+ * @return CApplication
*/
public function setId($id)
{
$this->_id=$id;
+ return $this;
}
/**
@@ -229,6 +231,7 @@ abstract class CApplication extends CModule
* Sets the root directory of the application.
* This method can only be invoked at the begin of the constructor.
* @param string $path the root directory of the application.
+ * @return CApplication
* @throws CException if the directory does not exist.
*/
public function setBasePath($path)
@@ -236,6 +239,7 @@ abstract class CApplication extends CModule
if(($this->_basePath=realpath($path))===false || !is_dir($this->_basePath))
throw new CException(Yii::t('yii','Application base path "{path}" is not a valid directory.',
array('{path}'=>$path)));
+ return $this;
}
/**
@@ -256,6 +260,7 @@ abstract class CApplication extends CModule
/**
* Sets the directory that stores runtime files.
* @param string $path the directory that stores runtime files.
+ * @return CApplication
* @throws CException if the directory does not exist or is not writable
*/
public function setRuntimePath($path)
@@ -264,6 +269,7 @@ abstract class CApplication extends CModule
throw new CException(Yii::t('yii','Application runtime path "{path}" is not valid. Please make sure it is a directory writable by the Web server process.',
array('{path}'=>$path)));
$this->_runtimePath=$runtimePath;
+ return $this;
}
/**
@@ -278,6 +284,7 @@ abstract class CApplication extends CModule
/**
* Sets the root directory that holds all third-party extensions.
* @param string $path the directory that contains all third-party extensions.
+ * @return CApplication
*/
public function setExtensionPath($path)
{
@@ -285,6 +292,7 @@ abstract class CApplication extends CModule
throw new CException(Yii::t('yii','Extension path "{path}" does not exist.',
array('{path}'=>$path)));
Yii::setPathOfAlias('ext',$extensionPath);
+ return $this;
}
/**
@@ -307,10 +315,12 @@ abstract class CApplication extends CModule
* set this language to null to maximize the application's performance.
* @param string $language the user language (e.g. 'en_US', 'zh_CN').
* If it is null, the {@link sourceLanguage} will be used.
+ * @return CApplication
*/
public function setLanguage($language)
{
$this->_language=$language;
+ return $this;
}
/**
@@ -330,11 +340,13 @@ abstract class CApplication extends CModule
* This is a simple wrapper of PHP function date_default_timezone_set().
* @param string $value the time zone used by this application.
* @see http://php.net/manual/en/function.date-default-timezone-set.php
+ * @return CApplication
* @since 1.0.9
*/
public function setTimeZone($value)
{
date_default_timezone_set($value);
+ return $this;
}
/**
@@ -391,11 +403,13 @@ abstract class CApplication extends CModule
/**
* Sets the directory that contains the locale data.
* @param string $value the directory that contains the locale data.
+ * @return CApplication
* @since 1.1.0
*/
public function setLocaleDataPath($value)
{
CLocale::$dataPath=$value;
+ return $this;
}
/**
@@ -525,6 +539,7 @@ abstract class CApplication extends CModule
* @param string $key the name of the value to be saved
* @param mixed $value the global value to be saved. It must be serializable.
* @param mixed $defaultValue the default value. If the named global value is the same as this value, it will be cleared from the current storage.
+ * @return CApplication
* @see getGlobalState
*/
public function setGlobalState($key,$value,$defaultValue=null)
@@ -549,6 +564,8 @@ abstract class CApplication extends CModule
if($this->_stateChanged!==$changed)
$this->attachEventHandler('onEndRequest',array($this,'saveGlobalState'));
+
+ return $this;
}
/**
@@ -556,16 +573,19 @@ abstract class CApplication extends CModule
*
* The value cleared will no longer be available in this request and the following requests.
* @param string $key the name of the value to be cleared
+ * @return CApplication
*/
public function clearGlobalState($key)
{
$this->setGlobalState($key,true,true);
+ return $this;
}
/**
* Loads the global state data from persistent storage.
* @see getStatePersister
* @throws CException if the state persister is not available
+ * @return CApplication
*/
public function loadGlobalState()
{
@@ -574,12 +594,14 @@ abstract class CApplication extends CModule
$this->_globalState=array();
$this->_stateChanged=false;
$this->detachEventHandler('onEndRequest',array($this,'saveGlobalState'));
+ return $this;
}
/**
* Saves the global state data into persistent storage.
* @see getStatePersister
* @throws CException if the state persister is not available
+ * @return CApplication
*/
public function saveGlobalState()
{
@@ -589,6 +611,7 @@ abstract class CApplication extends CModule
$this->detachEventHandler('onEndRequest',array($this,'saveGlobalState'));
$this->getStatePersister()->save($this->_globalState);
}
+ return $this;
}
/**
diff --git a/framework/base/CBehavior.php b/framework/base/CBehavior.php
index 48ede394a..349b3da92 100644
--- a/framework/base/CBehavior.php
+++ b/framework/base/CBehavior.php
@@ -39,12 +39,14 @@ class CBehavior extends CComponent implements IBehavior
* and attach event handlers as declared in {@link events}.
* Make sure you call the parent implementation if you override this method.
* @param CComponent $owner the component that this behavior is to be attached to.
+ * @return CBehavior
*/
public function attach($owner)
{
$this->_owner=$owner;
foreach($this->events() as $event=>$handler)
$owner->attachEventHandler($event,array($this,$handler));
+ return $this;
}
/**
@@ -53,12 +55,14 @@ class CBehavior extends CComponent implements IBehavior
* and detach event handlers declared in {@link events}.
* Make sure you call the parent implementation if you override this method.
* @param CComponent $owner the component that this behavior is to be detached from.
+ * @return CBehavior
*/
public function detach($owner)
{
foreach($this->events() as $event=>$handler)
$owner->detachEventHandler($event,array($this,$handler));
$this->_owner=null;
+ return $this;
}
/**
@@ -79,6 +83,7 @@ class CBehavior extends CComponent implements IBehavior
/**
* @param boolean $value whether this behavior is enabled
+ * @return CBehavior
*/
public function setEnabled($value)
{
@@ -96,5 +101,6 @@ class CBehavior extends CComponent implements IBehavior
}
}
$this->_enabled=$value;
+ return $this;
}
}
diff --git a/framework/base/CComponent.php b/framework/base/CComponent.php
index 198433a54..522573cb4 100644
--- a/framework/base/CComponent.php
+++ b/framework/base/CComponent.php
@@ -292,16 +292,19 @@ class CComponent
* )
*
* @param array $behaviors list of behaviors to be attached to the component
+ * @return CComponent
* @since 1.0.2
*/
public function attachBehaviors($behaviors)
{
foreach($behaviors as $name=>$behavior)
$this->attachBehavior($name,$behavior);
+ return $this;
}
/**
* Detaches all behaviors from the component.
+ * @return CComponent
* @since 1.0.2
*/
public function detachBehaviors()
@@ -312,6 +315,7 @@ class CComponent
$this->detachBehavior($name);
$this->_m=null;
}
+ return $this;
}
/**
@@ -354,6 +358,7 @@ class CComponent
/**
* Enables all behaviors attached to this component.
+ * @return CComponent
* @since 1.0.2
*/
public function enableBehaviors()
@@ -363,10 +368,12 @@ class CComponent
foreach($this->_m as $behavior)
$behavior->setEnabled(true);
}
+ return $this;
}
/**
* Disables all behaviors attached to this component.
+ * @return CComponent
* @since 1.0.2
*/
public function disableBehaviors()
@@ -376,6 +383,7 @@ class CComponent
foreach($this->_m as $behavior)
$behavior->setEnabled(false);
}
+ return $this;
}
/**
@@ -383,24 +391,28 @@ class CComponent
* A behavior is only effective when it is enabled.
* A behavior is enabled when first attached.
* @param string $name the behavior's name. It uniquely identifies the behavior.
+ * @return CComponent
* @since 1.0.2
*/
public function enableBehavior($name)
{
if(isset($this->_m[$name]))
$this->_m[$name]->setEnabled(true);
+ return $this;
}
/**
* Disables an attached behavior.
* A behavior is only effective when it is enabled.
* @param string $name the behavior's name. It uniquely identifies the behavior.
+ * @return CComponent
* @since 1.0.2
*/
public function disableBehavior($name)
{
if(isset($this->_m[$name]))
$this->_m[$name]->setEnabled(false);
+ return $this;
}
/**
@@ -515,12 +527,14 @@ class CComponent
*
* @param string $name the event name
* @param callback $handler the event handler
+ * @return CComponent
* @throws CException if the event is not defined
* @see detachEventHandler
*/
public function attachEventHandler($name,$handler)
{
$this->getEventHandlers($name)->add($handler);
+ return $this;
}
/**
@@ -545,6 +559,7 @@ class CComponent
* all attached handlers for the event.
* @param string $name the event name
* @param CEvent $event the event parameter
+ * @return CComponent
* @throws CException if the event is undefined or an event handler is invalid.
*/
public function raiseEvent($name,$event)
@@ -578,12 +593,14 @@ class CComponent
array('{class}'=>get_class($this), '{event}'=>$name, '{handler}'=>gettype($handler))));
// stop further handling if param.handled is set true
if(($event instanceof CEvent) && $event->handled)
- return;
+ return $this;
}
}
else if(YII_DEBUG && !$this->hasEvent($name))
throw new CException(Yii::t('yii','Event "{class}.{event}" is not defined.',
array('{class}'=>get_class($this), '{event}'=>$name)));
+
+ return $this;
}
/**
diff --git a/framework/base/CModel.php b/framework/base/CModel.php
index 18b806e6e..971c05b2c 100644
--- a/framework/base/CModel.php
+++ b/framework/base/CModel.php
@@ -373,10 +373,12 @@ abstract class CModel extends CComponent implements IteratorAggregate, ArrayAcce
* Adds a new error to the specified attribute.
* @param string $attribute attribute name
* @param string $error new error message
+ * @return CModel
*/
public function addError($attribute,$error)
{
$this->_errors[$attribute][]=$error;
+ return $this;
}
/**
@@ -385,6 +387,7 @@ abstract class CModel extends CComponent implements IteratorAggregate, ArrayAcce
* The array values should be error messages. If an attribute has multiple errors,
* these errors must be given in terms of an array.
* You may use the result of {@link getErrors} as the value for this parameter.
+ * @return CModel
* @since 1.0.5
*/
public function addErrors($errors)
@@ -399,11 +402,13 @@ abstract class CModel extends CComponent implements IteratorAggregate, ArrayAcce
else
$this->_errors[$attribute][]=$error;
}
+ return $this;
}
/**
* Removes errors for all attributes or a single attribute.
* @param string $attribute attribute name. Use null to remove errors for all attribute.
+ * @return CModel
*/
public function clearErrors($attribute=null)
{
@@ -411,6 +416,7 @@ abstract class CModel extends CComponent implements IteratorAggregate, ArrayAcce
$this->_errors=array();
else
unset($this->_errors[$attribute]);
+ return $this;
}
/**
@@ -455,13 +461,14 @@ abstract class CModel extends CComponent implements IteratorAggregate, ArrayAcce
* @param array $values attribute values (name=>value) to be set.
* @param boolean $safeOnly whether the assignments should only be done to the safe attributes.
* A safe attribute is one that is associated with a validation rule in the current {@link scenario}.
+ * @return CModel
* @see getSafeAttributeNames
* @see attributeNames
*/
public function setAttributes($values,$safeOnly=true)
{
if(!is_array($values))
- return;
+ return $this;
$attributes=array_flip($safeOnly ? $this->getSafeAttributeNames() : $this->attributeNames());
foreach($values as $name=>$value)
{
@@ -470,12 +477,14 @@ abstract class CModel extends CComponent implements IteratorAggregate, ArrayAcce
else if($safeOnly)
$this->onUnsafeAttribute($name,$value);
}
+ return $this;
}
/**
* Unsets the attributes.
* @param array $names list of attributes to be set null. If this parameter is not given,
* all attributes as specified by {@link attributeNames} will have their values unset.
+ * @return CModel
* @since 1.1.3
*/
public function unsetAttributes($names=null)
@@ -484,6 +493,7 @@ abstract class CModel extends CComponent implements IteratorAggregate, ArrayAcce
$names=$this->attributeNames();
foreach($names as $name)
$this->$name=null;
+ return $this;
}
/**
@@ -525,12 +535,14 @@ abstract class CModel extends CComponent implements IteratorAggregate, ArrayAcce
/**
* Sets the scenario for the model.
* @param string $value the scenario that this model is in.
+ * @return CModel
* @see getScenario
* @since 1.0.4
*/
public function setScenario($value)
{
$this->_scenario=$value;
+ return $this;
}
/**
diff --git a/framework/base/CModule.php b/framework/base/CModule.php
index d44465913..5c49f0c15 100644
--- a/framework/base/CModule.php
+++ b/framework/base/CModule.php
@@ -115,10 +115,12 @@ abstract class CModule extends CComponent
/**
* Sets the module ID.
* @param string $id the module ID
+ * @return CModule
*/
public function setId($id)
{
$this->_id=$id;
+ return $this;
}
/**
@@ -139,6 +141,7 @@ abstract class CModule extends CComponent
* Sets the root directory of the module.
* This method can only be invoked at the beginning of the constructor.
* @param string $path the root directory of the module.
+ * @return CModule
* @throws CException if the directory does not exist.
*/
public function setBasePath($path)
@@ -146,6 +149,7 @@ abstract class CModule extends CComponent
if(($this->_basePath=realpath($path))===false || !is_dir($this->_basePath))
throw new CException(Yii::t('yii','Base path "{path}" is not a valid directory.',
array('{path}'=>$path)));
+ return $this;
}
/**
@@ -167,12 +171,14 @@ abstract class CModule extends CComponent
/**
* Sets user-defined parameters.
* @param array $value user-defined parameters. This should be in name-value pairs.
+ * @return CModule
*/
public function setParams($value)
{
$params=$this->getParams();
foreach($value as $k=>$v)
$params->add($k,$v);
+ return $this;
}
/**
@@ -190,6 +196,7 @@ abstract class CModule extends CComponent
/**
* Sets the directory that contains the application modules.
* @param string $value the directory that contains the application modules.
+ * @return CModule
* @throws CException if the directory is invalid
*/
public function setModulePath($value)
@@ -197,16 +204,19 @@ abstract class CModule extends CComponent
if(($this->_modulePath=realpath($value))===false || !is_dir($this->_modulePath))
throw new CException(Yii::t('yii','The module path "{path}" is not a valid directory.',
array('{path}'=>$value)));
+ return $this;
}
/**
* Sets the aliases that are used in the module.
* @param array $aliases list of aliases to be imported
+ * @return CModule
*/
public function setImport($aliases)
{
foreach($aliases as $alias)
Yii::import($alias);
+ return $this;
}
/**
@@ -221,6 +231,7 @@ abstract class CModule extends CComponent
* 'backend'=>dirname(__FILE__).'/../backend', // a directory
* )
*
+ * @return CModule
* @since 1.0.5
*/
public function setAliases($mappings)
@@ -232,6 +243,7 @@ abstract class CModule extends CComponent
else
Yii::setPathOfAlias($name,$alias);
}
+ return $this;
}
/**
@@ -316,6 +328,7 @@ abstract class CModule extends CComponent
* You may also enable or disable a module by specifying the 'enabled' option in the configuration.
*
* @param array $modules module configurations.
+ * @return CModule
*/
public function setModules($modules)
{
@@ -337,6 +350,7 @@ abstract class CModule extends CComponent
else
$this->_moduleConfig[$id]=$module;
}
+ return $this;
}
/**
@@ -382,6 +396,7 @@ abstract class CModule extends CComponent
* @param string $id component ID
* @param IApplicationComponent $component the component to be added to the module.
* If this parameter is null, it will unload the component from the module.
+ * @return CModule
*/
public function setComponent($id,$component)
{
@@ -393,6 +408,7 @@ abstract class CModule extends CComponent
if(!$component->getIsInitialized())
$component->init();
}
+ return $this;
}
/**
@@ -441,6 +457,7 @@ abstract class CModule extends CComponent
* @param boolean $merge whether to merge the new component configuration with the existing one.
* Defaults to true, meaning the previously registered component configuration of the same ID
* will be merged with the new configuration. If false, the existing configuration will be replaced completely.
+ * @return CModule
*/
public function setComponents($components,$merge=true)
{
@@ -453,11 +470,13 @@ abstract class CModule extends CComponent
else
$this->_componentConfig[$id]=$component;
}
+ return $this;
}
/**
* Configures the module with the specified configuration.
* @param array $config the configuration array
+ * @return CModule
*/
public function configure($config)
{
@@ -466,6 +485,7 @@ abstract class CModule extends CComponent
foreach($config as $key=>$value)
$this->$key=$value;
}
+ return $this;
}
/**
diff --git a/framework/base/CSecurityManager.php b/framework/base/CSecurityManager.php
index a17a97413..deac9a2dd 100644
--- a/framework/base/CSecurityManager.php
+++ b/framework/base/CSecurityManager.php
@@ -99,6 +99,7 @@ class CSecurityManager extends CApplicationComponent
/**
* @param string $value the key used to generate HMAC
+ * @return CSecurityManager
* @throws CException if the key is empty
*/
public function setValidationKey($value)
@@ -107,6 +108,7 @@ class CSecurityManager extends CApplicationComponent
$this->_validationKey=$value;
else
throw new CException(Yii::t('yii','CSecurityManager.validationKey cannot be empty.'));
+ return $this;
}
/**
@@ -133,6 +135,7 @@ class CSecurityManager extends CApplicationComponent
/**
* @param string $value the key used to encrypt/decrypt data.
+ * @return CSecurityManager
* @throws CException if the key is empty
*/
public function setEncryptionKey($value)
@@ -141,6 +144,7 @@ class CSecurityManager extends CApplicationComponent
$this->_encryptionKey=$value;
else
throw new CException(Yii::t('yii','CSecurityManager.encryptionKey cannot be empty.'));
+ return $this;
}
/**
diff --git a/framework/base/CStatePersister.php b/framework/base/CStatePersister.php
index e9a291c73..ccc10168f 100644
--- a/framework/base/CStatePersister.php
+++ b/framework/base/CStatePersister.php
@@ -101,9 +101,11 @@ class CStatePersister extends CApplicationComponent implements IStatePersister
/**
* Saves application state in persistent storage.
* @param mixed $state state data (must be serializable).
+ * @return CStatePersister
*/
public function save($state)
{
file_put_contents($this->stateFile,serialize($state),LOCK_EX);
+ return $this;
}
}
diff --git a/framework/caching/CCache.php b/framework/caching/CCache.php
index 540db8375..c45b6eda4 100644
--- a/framework/caching/CCache.php
+++ b/framework/caching/CCache.php
@@ -325,7 +325,6 @@ abstract class CCache extends CApplicationComponent implements ICache, ArrayAcce
* Deletes the value with the specified key from cache
* This method is required by the interface ArrayAccess.
* @param string $id the key of the value to be deleted
- * @return boolean if no error happens during deletion
*/
public function offsetUnset($id)
{
diff --git a/framework/caching/CDbCache.php b/framework/caching/CDbCache.php
index de9e533cc..5b06da12e 100644
--- a/framework/caching/CDbCache.php
+++ b/framework/caching/CDbCache.php
@@ -165,11 +165,13 @@ EOD;
/**
* Sets the DB connection used by the cache component.
* @param CDbConnection $value the DB connection instance
+ * @return CDbCache
* @since 1.1.5
*/
public function setDbConnection($value)
{
$this->_db=$value;
+ return $this;
}
/**
diff --git a/framework/caching/CMemCache.php b/framework/caching/CMemCache.php
index a582be975..389f024d6 100644
--- a/framework/caching/CMemCache.php
+++ b/framework/caching/CMemCache.php
@@ -123,11 +123,13 @@ class CMemCache extends CCache
* @param array $config list of memcache server configurations. Each element must be an array
* with the following keys: host, port, persistent, weight, timeout, retryInterval, status.
* @see http://www.php.net/manual/en/function.Memcache-addServer.php
+ * @return CMemCache
*/
public function setServers($config)
{
foreach($config as $c)
$this->_servers[]=new CMemCacheServerConfiguration($c);
+ return $this;
}
/**
diff --git a/framework/caching/dependencies/CCacheDependency.php b/framework/caching/dependencies/CCacheDependency.php
index 8a72cd46a..3347ab82d 100644
--- a/framework/caching/dependencies/CCacheDependency.php
+++ b/framework/caching/dependencies/CCacheDependency.php
@@ -27,10 +27,12 @@ class CCacheDependency extends CComponent implements ICacheDependency
/**
* Evaluates the dependency by generating and saving the data related with dependency.
* This method is invoked by cache before writing data into it.
+ * @return CCacheDependency
*/
public function evaluateDependency()
{
$this->_data=$this->generateDependentData();
+ return $this;
}
/**
diff --git a/framework/caching/dependencies/CChainedCacheDependency.php b/framework/caching/dependencies/CChainedCacheDependency.php
index 718b10166..a81ed1541 100644
--- a/framework/caching/dependencies/CChainedCacheDependency.php
+++ b/framework/caching/dependencies/CChainedCacheDependency.php
@@ -52,6 +52,7 @@ class CChainedCacheDependency extends CComponent implements ICacheDependency
* @param array $values list of dependency objects or configurations to be added to this chain.
* If a depedency is specified as a configuration, it must be an array that can be recognized
* by {@link YiiBase::createComponent}.
+ * @return CChainedCacheDependency
* @since 1.0.10
*/
public function setDependencies($values)
@@ -63,10 +64,12 @@ class CChainedCacheDependency extends CComponent implements ICacheDependency
$value=Yii::createComponent($value);
$dependencies->add($value);
}
+ return $this;
}
/**
* Evaluates the dependency by generating and saving the data related with dependency.
+ * @return CChainedCacheDependency
*/
public function evaluateDependency()
{
@@ -75,6 +78,7 @@ class CChainedCacheDependency extends CComponent implements ICacheDependency
foreach($this->_dependencies as $dependency)
$dependency->evaluateDependency();
}
+ return $this;
}
/**
diff --git a/framework/collections/CAttributeCollection.php b/framework/collections/CAttributeCollection.php
index 24e0f8865..f24a16b76 100644
--- a/framework/collections/CAttributeCollection.php
+++ b/framework/collections/CAttributeCollection.php
@@ -112,6 +112,7 @@ class CAttributeCollection extends CMap
* This overrides the parent implementation by converting the key to lower case first if {@link caseSensitive} is false.
* @param mixed $key key
* @param mixed $value value
+ * @return CAttributeCollection
*/
public function add($key,$value)
{
@@ -119,6 +120,7 @@ class CAttributeCollection extends CMap
parent::add($key,$value);
else
parent::add(strtolower($key),$value);
+ return $this;
}
/**
diff --git a/framework/collections/CConfiguration.php b/framework/collections/CConfiguration.php
index ca090ba39..1b6c540c6 100644
--- a/framework/collections/CConfiguration.php
+++ b/framework/collections/CConfiguration.php
@@ -66,6 +66,7 @@ class CConfiguration extends CMap
*
*
* @param string $configFile configuration file path (if using relative path, be aware of what is the current path)
+ * @return CConfiguration
* @see mergeWith
*/
public function loadFromFile($configFile)
@@ -75,6 +76,7 @@ class CConfiguration extends CMap
$this->mergeWith($data);
else
$this->copyFrom($data);
+ return $this;
}
/**
@@ -92,11 +94,13 @@ class CConfiguration extends CMap
* Each (key,value) pair in the configuration data is applied
* to the object like: $object->$key=$value.
* @param object $object object to be applied with this configuration
+ * @return CConfiguration
*/
public function applyTo($object)
{
foreach($this->toArray() as $key=>$value)
$object->$key=$value;
+ return $this;
}
/**
diff --git a/framework/collections/CList.php b/framework/collections/CList.php
index 0a5c29d86..6536424bf 100644
--- a/framework/collections/CList.php
+++ b/framework/collections/CList.php
@@ -71,10 +71,12 @@ class CList extends CComponent implements IteratorAggregate,ArrayAccess,Countabl
/**
* @param boolean $value whether this list is read-only or not
+ * @return CList
*/
protected function setReadOnly($value)
{
$this->_r=$value;
+ return $this;
}
/**
@@ -141,6 +143,7 @@ class CList extends CComponent implements IteratorAggregate,ArrayAccess,Countabl
* will be moved one step towards the end.
* @param integer $index the specified position.
* @param mixed $item new item
+ * @return CList
* @throws CException If the index specified exceeds the bound or the list is read-only
*/
public function insertAt($index,$item)
@@ -160,6 +163,7 @@ class CList extends CComponent implements IteratorAggregate,ArrayAccess,Countabl
}
else
throw new CException(Yii::t('yii','The list is read only.'));
+ return $this;
}
/**
@@ -213,11 +217,13 @@ class CList extends CComponent implements IteratorAggregate,ArrayAccess,Countabl
/**
* Removes all items in the list.
+ * @return CList
*/
public function clear()
{
for($i=$this->_c-1;$i>=0;--$i)
$this->removeAt($i);
+ return $this;
}
/**
@@ -253,6 +259,7 @@ class CList extends CComponent implements IteratorAggregate,ArrayAccess,Countabl
* Copies iterable data into the list.
* Note, existing data in the list will be cleared first.
* @param mixed $data the data to be copied from, must be an array or object implementing Traversable
+ * @return CList
* @throws CException If data is neither an array nor a Traversable.
*/
public function copyFrom($data)
@@ -268,12 +275,14 @@ class CList extends CComponent implements IteratorAggregate,ArrayAccess,Countabl
}
else if($data!==null)
throw new CException(Yii::t('yii','List data must be an array or an object implementing Traversable.'));
+ return $this;
}
/**
* Merges iterable data into the map.
* New data will be appended to the end of the existing data.
* @param mixed $data the data to be merged with, must be an array or object implementing Traversable
+ * @return CList
* @throws CException If data is neither an array nor an iterator.
*/
public function mergeWith($data)
@@ -287,6 +296,7 @@ class CList extends CComponent implements IteratorAggregate,ArrayAccess,Countabl
}
else if($data!==null)
throw new CException(Yii::t('yii','List data must be an array or an object implementing Traversable.'));
+ return $this;
}
/**
diff --git a/framework/collections/CMap.php b/framework/collections/CMap.php
index a1a856b85..4ca0daf0b 100644
--- a/framework/collections/CMap.php
+++ b/framework/collections/CMap.php
@@ -63,10 +63,12 @@ class CMap extends CComponent implements IteratorAggregate,ArrayAccess,Countable
/**
* @param boolean $value whether this list is read-only or not
+ * @return CMap
*/
protected function setReadOnly($value)
{
$this->_r=$value;
+ return $this;
}
/**
@@ -125,6 +127,7 @@ class CMap extends CComponent implements IteratorAggregate,ArrayAccess,Countable
* Note, if the specified key already exists, the old value will be overwritten.
* @param mixed $key key
* @param mixed $value value
+ * @return CMap
* @throws CException if the map is read-only
*/
public function add($key,$value)
@@ -138,6 +141,7 @@ class CMap extends CComponent implements IteratorAggregate,ArrayAccess,Countable
}
else
throw new CException(Yii::t('yii','The map is read only.'));
+ return $this;
}
/**
@@ -169,11 +173,13 @@ class CMap extends CComponent implements IteratorAggregate,ArrayAccess,Countable
/**
* Removes all items in the map.
+ * @return CMap
*/
public function clear()
{
foreach(array_keys($this->_d) as $key)
$this->remove($key);
+ return $this;
}
/**
@@ -197,6 +203,7 @@ class CMap extends CComponent implements IteratorAggregate,ArrayAccess,Countable
* Copies iterable data into the map.
* Note, existing data in the map will be cleared first.
* @param mixed $data the data to be copied from, must be an array or object implementing Traversable
+ * @return CMap
* @throws CException If data is neither an array nor an iterator.
*/
public function copyFrom($data)
@@ -212,6 +219,7 @@ class CMap extends CComponent implements IteratorAggregate,ArrayAccess,Countable
}
else if($data!==null)
throw new CException(Yii::t('yii','Map data must be an array or an object implementing Traversable.'));
+ return $this;
}
/**
@@ -228,6 +236,7 @@ class CMap extends CComponent implements IteratorAggregate,ArrayAccess,Countable
*
* @param mixed $data the data to be merged with, must be an array or object implementing Traversable
* @param boolean $recursive whether the merging should be recursive.
+ * @return CMap
*
* @throws CException If data is neither an array nor an iterator.
*/
@@ -257,6 +266,7 @@ class CMap extends CComponent implements IteratorAggregate,ArrayAccess,Countable
}
else if($data!==null)
throw new CException(Yii::t('yii','Map data must be an array or an object implementing Traversable.'));
+ return $this;
}
/**
diff --git a/framework/collections/CQueue.php b/framework/collections/CQueue.php
index b90db5038..d65250c73 100644
--- a/framework/collections/CQueue.php
+++ b/framework/collections/CQueue.php
@@ -64,6 +64,7 @@ class CQueue extends CComponent implements IteratorAggregate,Countable
* Copies iterable data into the queue.
* Note, existing data in the list will be cleared first.
* @param mixed $data the data to be copied from, must be an array or object implementing Traversable
+ * @return CQueue
* @throws CException If data is neither an array nor a Traversable.
*/
public function copyFrom($data)
@@ -79,15 +80,18 @@ class CQueue extends CComponent implements IteratorAggregate,Countable
}
else if($data!==null)
throw new CException(Yii::t('yii','Queue data must be an array or an object implementing Traversable.'));
+ return $this;
}
/**
* Removes all items in the queue.
+ * @return CQueue
*/
public function clear()
{
$this->_c=0;
$this->_d=array();
+ return $this;
}
/**
@@ -131,11 +135,13 @@ class CQueue extends CComponent implements IteratorAggregate,Countable
/**
* Adds an object to the end of the queue.
* @param mixed $item the item to be appended into the queue
+ * @return CQueue
*/
public function enqueue($item)
{
++$this->_c;
array_push($this->_d,$item);
+ return $this;
}
/**
diff --git a/framework/collections/CStack.php b/framework/collections/CStack.php
index 687ee229a..f1a0aa8a4 100644
--- a/framework/collections/CStack.php
+++ b/framework/collections/CStack.php
@@ -64,6 +64,7 @@ class CStack extends CComponent implements IteratorAggregate,Countable
* Copies iterable data into the stack.
* Note, existing data in the list will be cleared first.
* @param mixed $data the data to be copied from, must be an array or object implementing Traversable
+ * @return CStack
* @throws CException If data is neither an array nor a Traversable.
*/
public function copyFrom($data)
@@ -79,15 +80,18 @@ class CStack extends CComponent implements IteratorAggregate,Countable
}
else if($data!==null)
throw new CException(Yii::t('yii','Stack data must be an array or an object implementing Traversable.'));
+ return $this;
}
/**
* Removes all items in the stack.
+ * @return CStack
*/
public function clear()
{
$this->_c=0;
$this->_d=array();
+ return $this;
}
/**
@@ -132,11 +136,13 @@ class CStack extends CComponent implements IteratorAggregate,Countable
/**
* Pushes an item into the stack.
* @param mixed $item the item to be pushed into the stack
+ * @return CStack
*/
public function push($item)
{
++$this->_c;
array_push($this->_d,$item);
+ return $this;
}
/**
diff --git a/framework/collections/CTypedList.php b/framework/collections/CTypedList.php
index 6a4f5774a..e0de9c8b8 100644
--- a/framework/collections/CTypedList.php
+++ b/framework/collections/CTypedList.php
@@ -38,6 +38,7 @@ class CTypedList extends CList
* checking the item to be inserted is of certain type.
* @param integer $index the specified position.
* @param mixed $item new item
+ * @return CTypedList
* @throws CException If the index specified exceeds the bound,
* the list is read-only or the element is not of the expected type.
*/
@@ -48,5 +49,6 @@ class CTypedList extends CList
else
throw new CException(Yii::t('yii','CTypedList<{type}> can only hold objects of {type} class.',
array('{type}'=>$this->_type)));
+ return $this;
}
}
diff --git a/framework/collections/CTypedMap.php b/framework/collections/CTypedMap.php
index 2c62ae83b..9d40010a4 100644
--- a/framework/collections/CTypedMap.php
+++ b/framework/collections/CTypedMap.php
@@ -38,6 +38,7 @@ class CTypedMap extends CMap
* checking the item to be inserted is of certain type.
* @param integer $index the specified position.
* @param mixed $item new item
+ * @return CTypedMap
* @throws CException If the index specified exceeds the bound,
* the map is read-only or the element is not of the expected type.
*/
@@ -48,5 +49,6 @@ class CTypedMap extends CMap
else
throw new CException(Yii::t('yii','CTypedMap<{type}> can only hold objects of {type} class.',
array('{type}'=>$this->_type)));
+ return $this;
}
}
diff --git a/framework/console/CConsoleApplication.php b/framework/console/CConsoleApplication.php
index ca4f91228..260d6f1c1 100644
--- a/framework/console/CConsoleApplication.php
+++ b/framework/console/CConsoleApplication.php
@@ -152,6 +152,7 @@ class CConsoleApplication extends CApplication
/**
* @param string $value the directory that contains the command classes.
+ * @return CConsoleApplication
* @throws CException if the directory is invalid
*/
public function setCommandPath($value)
@@ -159,6 +160,7 @@ class CConsoleApplication extends CApplication
if(($this->_commandPath=realpath($value))===false || !is_dir($this->_commandPath))
throw new CException(Yii::t('yii','The command path "{path}" is not a valid directory.',
array('{path}'=>$value)));
+ return $this;
}
/**
diff --git a/framework/console/CConsoleCommand.php b/framework/console/CConsoleCommand.php
index 532d1d74c..4945947fd 100644
--- a/framework/console/CConsoleCommand.php
+++ b/framework/console/CConsoleCommand.php
@@ -295,6 +295,7 @@ abstract class CConsoleCommand extends CComponent
*
params: optional, the parameters to be passed to the callback
*
* @see buildFileList
+ * @return CConsoleCommand
*/
public function copyFiles($fileList)
{
@@ -353,6 +354,7 @@ abstract class CConsoleCommand extends CComponent
}
file_put_contents($target,$content);
}
+ return $this;
}
/**
@@ -387,6 +389,7 @@ abstract class CConsoleCommand extends CComponent
/**
* Creates all parent directories if they do not exist.
* @param string $directory the directory to be checked
+ * @return CConsoleCommand
*/
public function ensureDirectory($directory)
{
@@ -396,6 +399,7 @@ abstract class CConsoleCommand extends CComponent
echo " mkdir ".strtr($directory,'\\','/')."\n";
mkdir($directory);
}
+ return $this;
}
/**
diff --git a/framework/console/CConsoleCommandRunner.php b/framework/console/CConsoleCommandRunner.php
index 212825316..e5311f28c 100644
--- a/framework/console/CConsoleCommandRunner.php
+++ b/framework/console/CConsoleCommandRunner.php
@@ -95,6 +95,7 @@ class CConsoleCommandRunner extends CComponent
* Adds commands from the specified command path.
* If a command already exists, the new one will be ignored.
* @param string $path the alias of the directory containing the command class files.
+ * @return CConsoleCommandRunner
*/
public function addCommands($path)
{
@@ -106,6 +107,7 @@ class CConsoleCommandRunner extends CComponent
$this->commands[$name]=$file;
}
}
+ return $this;
}
/**
diff --git a/framework/db/CDbCommand.php b/framework/db/CDbCommand.php
index de2e65fa0..cc81f0ae8 100644
--- a/framework/db/CDbCommand.php
+++ b/framework/db/CDbCommand.php
@@ -181,6 +181,7 @@ class CDbCommand extends CComponent
* this may improve performance.
* For SQL statement with binding parameters, this method is invoked
* automatically.
+ * @return CDbCommand
*/
public function prepare()
{
@@ -199,14 +200,17 @@ class CDbCommand extends CComponent
array('{error}'=>$e->getMessage())),(int)$e->getCode(),$errorInfo);
}
}
+ return $this;
}
/**
* Cancels the execution of the SQL statement.
+ * @return CDbCommand
*/
public function cancel()
{
$this->_statement=null;
+ return $this;
}
/**
@@ -608,11 +612,13 @@ class CDbCommand extends CComponent
* Sets the SELECT part in the query.
* @param mixed $value the data to be selected. Please refer to {@link select()} for details
* on how to specify this parameter.
+ * @return CDbCommand
* @since 1.1.6
*/
public function setSelect($value)
{
$this->select($value);
+ return $this;
}
/**
@@ -641,11 +647,13 @@ class CDbCommand extends CComponent
/**
* Sets a value indicating whether SELECT DISTINCT should be used.
* @param boolean $value a value indicating whether SELECT DISTINCT should be used.
+ * @return CDbCommand
* @since 1.1.6
*/
public function setDistinct($value)
{
$this->_query['distinct']=$value;
+ return $this;
}
/**
@@ -695,11 +703,13 @@ class CDbCommand extends CComponent
* Sets the FROM part in the query.
* @param mixed $value the tables to be selected from. Please refer to {@link from()} for details
* on how to specify this parameter.
+ * @return CDbCommand
* @since 1.1.6
*/
public function setFrom($value)
{
$this->from($value);
+ return $this;
}
/**
@@ -762,11 +772,13 @@ class CDbCommand extends CComponent
* Sets the WHERE part in the query.
* @param mixed $value the where part. Please refer to {@link where()} for details
* on how to specify this parameter.
+ * @return CDbCommand
* @since 1.1.6
*/
public function setWhere($value)
{
$this->where($value);
+ return $this;
}
/**
@@ -803,11 +815,13 @@ class CDbCommand extends CComponent
* @param mixed $value the join part in the query. This can be either a string or
* an array representing multiple join parts in the query. Each part must contain
* the proper join operator (e.g. 'LEFT JOIN tbl_profile ON tbl_user.id=tbl_profile.id')
+ * @return CDbCommand
* @since 1.1.6
*/
public function setJoin($value)
{
$this->_query['join']=$value;
+ return $this;
}
/**
@@ -917,11 +931,13 @@ class CDbCommand extends CComponent
* Sets the GROUP BY part in the query.
* @param mixed $value the GROUP BY part. Please refer to {@link group()} for details
* on how to specify this parameter.
+ * @return CDbCommand
* @since 1.1.6
*/
public function setGroup($value)
{
$this->group($value);
+ return $this;
}
/**
@@ -954,11 +970,13 @@ class CDbCommand extends CComponent
* Sets the HAVING part in the query.
* @param mixed $value the HAVING part. Please refer to {@link having()} for details
* on how to specify this parameter.
+ * @return CDbCommand
* @since 1.1.6
*/
public function setHaving($value)
{
$this->having($value);
+ return $this;
}
/**
@@ -1009,11 +1027,13 @@ class CDbCommand extends CComponent
* Sets the ORDER BY part in the query.
* @param mixed $value the ORDER BY part. Please refer to {@link order()} for details
* on how to specify this parameter.
+ * @return CDbCommand
* @since 1.1.6
*/
public function setOrder($value)
{
$this->order($value);
+ return $this;
}
/**
@@ -1045,11 +1065,13 @@ class CDbCommand extends CComponent
* Sets the LIMIT part in the query.
* @param integer $value the LIMIT part. Please refer to {@link limit()} for details
* on how to specify this parameter.
+ * @return CDbCommand
* @since 1.1.6
*/
public function setLimit($value)
{
$this->limit($value);
+ return $this;
}
/**
@@ -1078,11 +1100,13 @@ class CDbCommand extends CComponent
* Sets the OFFSET part in the query.
* @param integer $value the OFFSET part. Please refer to {@link offset()} for details
* on how to specify this parameter.
+ * @return CDbCommand
* @since 1.1.6
*/
public function setOffset($value)
{
$this->offset($value);
+ return $this;
}
/**
@@ -1116,11 +1140,13 @@ class CDbCommand extends CComponent
* Sets the UNION part in the query.
* @param mixed $value the UNION part. This can be either a string or an array
* representing multiple SQL statements to be unioned together.
+ * @return CDbCommand
* @since 1.1.6
*/
public function setUnion($value)
{
$this->_query['union']=$value;
+ return $this;
}
/**
diff --git a/framework/db/CDbConnection.php b/framework/db/CDbConnection.php
index 1273869e5..9f4cf473e 100644
--- a/framework/db/CDbConnection.php
+++ b/framework/db/CDbConnection.php
@@ -287,6 +287,7 @@ class CDbConnection extends CApplicationComponent
/**
* Open or close the DB connection.
* @param boolean $value whether to open or close DB connection
+ * @return CDbConnection
* @throws CException if connection fails
*/
public function setActive($value)
@@ -298,6 +299,7 @@ class CDbConnection extends CApplicationComponent
else
$this->close();
}
+ return $this;
}
/**
@@ -326,6 +328,7 @@ class CDbConnection extends CApplicationComponent
/**
* Opens DB connection if it is currently not
+ * @return CDbConnection
* @throws CException if connection fails
*/
protected function open()
@@ -355,11 +358,13 @@ class CDbConnection extends CApplicationComponent
}
}
}
+ return $this;
}
/**
* Closes the currently active DB connection.
* It does nothing if the connection is already closed.
+ * @return CDbConnection
*/
protected function close()
{
@@ -367,6 +372,7 @@ class CDbConnection extends CApplicationComponent
$this->_pdo=null;
$this->_active=false;
$this->_schema=null;
+ return $this;
}
/**
@@ -589,11 +595,13 @@ class CDbConnection extends CApplicationComponent
/**
* Sets the case of the column names.
* @param mixed $value the case of the column names
+ * @return CDbConnection
* @see http://www.php.net/manual/en/pdo.setattribute.php
*/
public function setColumnCase($value)
{
$this->setAttribute(PDO::ATTR_CASE,$value);
+ return $this;
}
/**
@@ -609,11 +617,13 @@ class CDbConnection extends CApplicationComponent
/**
* Sets how the null and empty strings are converted.
* @param mixed $value how the null and empty strings are converted
+ * @return CDbConnection
* @see http://www.php.net/manual/en/pdo.setattribute.php
*/
public function setNullConversion($value)
{
$this->setAttribute(PDO::ATTR_ORACLE_NULLS,$value);
+ return $this;
}
/**
@@ -630,10 +640,12 @@ class CDbConnection extends CApplicationComponent
* Sets whether creating or updating a DB record will be automatically committed.
* Some DBMS (such as sqlite) may not support this feature.
* @param boolean $value whether creating or updating a DB record will be automatically committed.
+ * @return CDbConnection
*/
public function setAutoCommit($value)
{
$this->setAttribute(PDO::ATTR_AUTOCOMMIT,$value);
+ return $this;
}
/**
@@ -650,6 +662,7 @@ class CDbConnection extends CApplicationComponent
* Sets whether the connection is persistent or not.
* Some DBMS (such as sqlite) may not support this feature.
* @param boolean $value whether the connection is persistent or not
+ * @return CDbConnection
*/
public function setPersistent($value)
{
@@ -739,6 +752,7 @@ class CDbConnection extends CApplicationComponent
* @param integer $name the attribute to be set
* @param mixed $value the attribute value
* @see http://www.php.net/manual/en/function.PDO-setAttribute.php
+ * @return CDbConnection
*/
public function setAttribute($name,$value)
{
@@ -746,6 +760,7 @@ class CDbConnection extends CApplicationComponent
$this->_pdo->setAttribute($name,$value);
else
$this->_attributes[$name]=$value;
+ return $this;
}
/**
diff --git a/framework/db/CDbDataReader.php b/framework/db/CDbDataReader.php
index 6cdd8c228..081953d73 100644
--- a/framework/db/CDbDataReader.php
+++ b/framework/db/CDbDataReader.php
@@ -57,6 +57,7 @@ class CDbDataReader extends CComponent implements Iterator, Countable
* @param mixed $value Name of the PHP variable to which the column will be bound.
* @param integer $dataType Data type of the parameter
* @see http://www.php.net/manual/en/function.PDOStatement-bindColumn.php
+ * @return CDbDataReader
*/
public function bindColumn($column, &$value, $dataType=null)
{
@@ -64,17 +65,20 @@ class CDbDataReader extends CComponent implements Iterator, Countable
$this->_statement->bindColumn($column,$value);
else
$this->_statement->bindColumn($column,$value,$dataType);
+ return $this;
}
/**
* Set the default fetch mode for this statement
* @param mixed $mode fetch mode
* @see http://www.php.net/manual/en/function.PDOStatement-setFetchMode.php
+ * @return CDbDataReader
*/
public function setFetchMode($mode)
{
$params=func_get_args();
call_user_func_array(array($this->_statement,'setFetchMode'),$params);
+ return $this;
}
/**
@@ -133,11 +137,13 @@ class CDbDataReader extends CComponent implements Iterator, Countable
* Closes the reader.
* This frees up the resources allocated for executing this SQL statement.
* Read attemps after this method call are unpredictable.
+ * @return CDbDataReader
*/
public function close()
{
$this->_statement->closeCursor();
$this->_closed=true;
+ return $this;
}
/**
diff --git a/framework/db/CDbMigration.php b/framework/db/CDbMigration.php
index c6db5f27e..6c9e649b2 100644
--- a/framework/db/CDbMigration.php
+++ b/framework/db/CDbMigration.php
@@ -76,10 +76,12 @@ abstract class CDbMigration extends CComponent
* Sets the currently active database connection.
* The database connection will be used by the methods such as {@link insert}, {@link createTable}.
* @param CDbConnection $db the database connection component
+ * @return CDbMigration
*/
public function setDbConnection($db)
{
$this->_db=$db;
+ return $this;
}
/**
@@ -87,6 +89,7 @@ abstract class CDbMigration extends CComponent
* The method will properly escape the column names, and bind the values to be inserted.
* @param string $table the table that new rows will be inserted into.
* @param array $columns the column data (name=>value) to be inserted into the table.
+ * @return CDbMigration
*/
public function insert($table, $columns)
{
@@ -94,6 +97,7 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->insert($table, $columns);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
@@ -104,6 +108,7 @@ abstract class CDbMigration extends CComponent
* @param mixed $conditions the conditions that will be put in the WHERE part. Please
* refer to {@link where} on how to specify conditions.
* @param array $params the parameters to be bound to the query.
+ * @return CDbMigration
*/
public function update($table, $columns, $conditions='', $params=array())
{
@@ -111,6 +116,7 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->update($table, $columns, $conditions, $params);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
@@ -119,6 +125,7 @@ abstract class CDbMigration extends CComponent
* @param mixed $conditions the conditions that will be put in the WHERE part. Please
* refer to {@link where} on how to specify conditions.
* @param array $params the parameters to be bound to the query.
+ * @return CDbMigration
*/
public function delete($table, $conditions='', $params=array())
{
@@ -126,6 +133,7 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->delete($table, $conditions, $params);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
@@ -142,6 +150,7 @@ abstract class CDbMigration extends CComponent
* @param string $table the name of the table to be created. The name will be properly quoted by the method.
* @param array $columns the columns (name=>definition) in the new table.
* @param string $options additional SQL fragment that will be appended to the generated SQL.
+ * @return CDbMigration
*/
public function createTable($table, $columns, $options=null)
{
@@ -149,12 +158,14 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->createTable($table, $columns, $options);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
* Builds and executes a SQL statement for renaming a DB table.
* @param string $table the table to be renamed. The name will be properly quoted by the method.
* @param string $newName the new table name. The name will be properly quoted by the method.
+ * @return CDbMigration
*/
public function renameTable($table, $newName)
{
@@ -162,11 +173,13 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->renameTable($table, $newName);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
* Builds and executes a SQL statement for dropping a DB table.
* @param string $table the table to be dropped. The name will be properly quoted by the method.
+ * @return CDbMigration
*/
public function dropTable($table)
{
@@ -174,11 +187,13 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->dropTable($table);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
* Builds and executes a SQL statement for truncating a DB table.
* @param string $table the table to be truncated. The name will be properly quoted by the method.
+ * @return CDbMigration
*/
public function truncateTable($table)
{
@@ -186,6 +201,7 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->truncateTable($table);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
@@ -195,6 +211,7 @@ abstract class CDbMigration extends CComponent
* @param string $type the column type. The {@link getColumnType} method will be invoked to convert abstract column type (if any)
* into the physical one. Anything that is not recognized as abstract type will be kept in the generated SQL.
* For example, 'string' will be turned into 'varchar(255)', while 'string not null' will become 'varchar(255) not null'.
+ * @return CDbMigration
*/
public function addColumn($table, $column, $type)
{
@@ -202,12 +219,14 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->addColumn($table, $column, $type);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
* Builds and executes a SQL statement for dropping a DB column.
* @param string $table the table whose column is to be dropped. The name will be properly quoted by the method.
* @param string $column the name of the column to be dropped. The name will be properly quoted by the method.
+ * @return CDbMigration
*/
public function dropColumn($table, $column)
{
@@ -215,6 +234,7 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->dropColumn($table, $column);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
@@ -222,6 +242,7 @@ abstract class CDbMigration extends CComponent
* @param string $table the table whose column is to be renamed. The name will be properly quoted by the method.
* @param string $name the old name of the column. The name will be properly quoted by the method.
* @param string $newName the new name of the column. The name will be properly quoted by the method.
+ * @return CDbMigration
*/
public function renameColumn($table, $name, $newName)
{
@@ -229,6 +250,7 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->renameColumn($table, $name, $newName);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
@@ -238,6 +260,7 @@ abstract class CDbMigration extends CComponent
* @param string $type the new column type. The {@link getColumnType} method will be invoked to convert abstract column type (if any)
* into the physical one. Anything that is not recognized as abstract type will be kept in the generated SQL.
* For example, 'string' will be turned into 'varchar(255)', while 'string not null' will become 'varchar(255) not null'.
+ * @return CDbMigration
*/
public function alterColumn($table, $column, $type)
{
@@ -245,6 +268,7 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->alterColumn($table, $column, $type);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
@@ -257,6 +281,7 @@ abstract class CDbMigration extends CComponent
* @param string $refColumns the name of the column that the foreign key references to. If there are multiple columns, separate them with commas.
* @param string $delete the ON DELETE option. Most DBMS support these options: RESTRICT, CASCADE, NO ACTION, SET DEFAULT, SET NULL
* @param string $update the ON UPDATE option. Most DBMS support these options: RESTRICT, CASCADE, NO ACTION, SET DEFAULT, SET NULL
+ * @return CDbMigration
*/
public function addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete=null, $update=null)
{
@@ -264,12 +289,14 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete, $update);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
* Builds a SQL statement for dropping a foreign key constraint.
* @param string $name the name of the foreign key constraint to be dropped. The name will be properly quoted by the method.
* @param string $table the table whose foreign is to be dropped. The name will be properly quoted by the method.
+ * @return CDbMigration
*/
public function dropForeignKey($name, $table)
{
@@ -277,6 +304,7 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->dropForeignKey($name, $table);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
@@ -286,6 +314,7 @@ abstract class CDbMigration extends CComponent
* @param string $column the column(s) that should be included in the index. If there are multiple columns, please separate them
* by commas. The column names will be properly quoted by the method.
* @param boolean $unique whether to add UNIQUE constraint on the created index.
+ * @return CDbMigration
*/
public function createIndex($name, $table, $column, $unique=false)
{
@@ -293,12 +322,14 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->createIndex($name, $table, $column, $unique);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
/**
* Builds and executes a SQL statement for dropping an index.
* @param string $name the name of the index to be dropped. The name will be properly quoted by the method.
* @param string $table the table whose index is to be dropped. The name will be properly quoted by the method.
+ * @return CDbMigration
*/
public function dropIndex($name, $table)
{
@@ -306,5 +337,6 @@ abstract class CDbMigration extends CComponent
$time=microtime(true);
$this->getDbConnection()->createCommand()->dropIndex($name, $table);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
+ return $this;
}
}
\ No newline at end of file
diff --git a/framework/db/CDbTransaction.php b/framework/db/CDbTransaction.php
index d69e97f0e..30c1e491e 100644
--- a/framework/db/CDbTransaction.php
+++ b/framework/db/CDbTransaction.php
@@ -100,9 +100,11 @@ class CDbTransaction extends CComponent
/**
* @param boolean $value whether this transaction is active
+ * @return CDbTransaction
*/
protected function setActive($value)
{
$this->_active=$value;
+ return $this;
}
}
diff --git a/framework/db/ar/CActiveRecord.php b/framework/db/ar/CActiveRecord.php
index 8953212af..d7edc33a6 100644
--- a/framework/db/ar/CActiveRecord.php
+++ b/framework/db/ar/CActiveRecord.php
@@ -312,11 +312,13 @@ abstract class CActiveRecord extends CModel
/**
* Sets the query criteria for the current model.
* @param CDbCriteria $criteria the query criteria
+ * @return CActiveRecord
* @since 1.1.3
*/
public function setDbCriteria($criteria)
{
$this->_c=$criteria;
+ return $this;
}
/**
@@ -392,6 +394,7 @@ abstract class CActiveRecord extends CModel
* This is useful if the table schema has been changed and you want to use the latest
* available table schema. Make sure you have called {@link CDbSchema::refresh}
* before you call this method. Otherwise, old table schema data will still be used.
+ * @return CActiveRecord
* @since 1.0.8
*/
public function refreshMetaData()
@@ -400,6 +403,7 @@ abstract class CActiveRecord extends CModel
$finder->_md=new CActiveRecordMetaData($finder);
if($this!==$finder)
$this->_md=$finder->_md;
+ return $this;
}
/**
@@ -799,11 +803,13 @@ abstract class CActiveRecord extends CModel
/**
* Sets if the record is new.
* @param boolean $value whether the record is new and should be inserted when calling {@link save}.
+ * @return CActiveRecord
* @see getIsNewRecord
*/
public function setIsNewRecord($value)
{
$this->_new=$value;
+ return $this;
}
/**
@@ -1200,6 +1206,7 @@ abstract class CActiveRecord extends CModel
* After calling this method, the old primary key value can be obtained from {@link oldPrimaryKey}.
* @param mixed $value the new primary key value. If the primary key is composite, the new value
* should be provided as an array (column name=>column value).
+ * @return CActiveRecord
* @since 1.1.0
*/
public function setPrimaryKey($value)
@@ -1213,6 +1220,7 @@ abstract class CActiveRecord extends CModel
foreach($table->primaryKey as $name)
$this->$name=$value[$name];
}
+ return $this;
}
/**
@@ -1232,11 +1240,13 @@ abstract class CActiveRecord extends CModel
/**
* Sets the old primary key value.
* @param mixed $value the old primary key value.
+ * @return CActiveRecord
* @since 1.1.3
*/
public function setOldPrimaryKey($value)
{
$this->_pk=$value;
+ return $this;
}
/*
@@ -1266,6 +1276,7 @@ abstract class CActiveRecord extends CModel
* This method merges {@link dbCriteria} with the given criteria parameter.
* It then resets {@link dbCriteria} to be null.
* @param CDbCriteria $criteria the query criteria. This parameter may be modified by merging {@link dbCriteria}.
+ * @return CActiveRecord
* @since 1.0.12
*/
public function applyScopes(&$criteria)
@@ -1314,6 +1325,8 @@ abstract class CActiveRecord extends CModel
$criteria=$c;
$this->_c=null;
}
+
+ return $this;
}
/**
@@ -1340,11 +1353,13 @@ abstract class CActiveRecord extends CModel
/**
* Sets the table alias to be used in queries.
* @param string $alias the table alias to be used in queries. The alias should NOT be quoted.
+ * @return CActiveRecord
* @since 1.1.3
*/
public function setTableAlias($alias)
{
$this->_alias=$alias;
+ return $this;
}
/**
@@ -1910,6 +1925,7 @@ class CBaseActiveRelation extends CComponent
* Merges this relation with a criteria specified dynamically.
* @param array $criteria the dynamically specified criteria
* @param boolean $fromScope whether the criteria to be merged is from scopes
+ * @return CBaseActiveRelation
* @since 1.0.5
*/
public function mergeWith($criteria,$fromScope=false)
@@ -1970,6 +1986,8 @@ class CBaseActiveRelation extends CComponent
else if($criteria['having']!=='')
$this->having="({$this->having}) AND ({$criteria['having']})";
}
+
+ return $this;
}
}
@@ -1998,6 +2016,7 @@ class CStatRelation extends CBaseActiveRelation
* Merges this relation with a criteria specified dynamically.
* @param array $criteria the dynamically specified criteria
* @param boolean $fromScope whether the criteria to be merged is from scopes
+ * @return CStatRelation
* @since 1.0.5
*/
public function mergeWith($criteria,$fromScope=false)
@@ -2008,6 +2027,8 @@ class CStatRelation extends CBaseActiveRelation
if(isset($criteria['defaultValue']))
$this->defaultValue=$criteria['defaultValue'];
+
+ return $this;
}
}
@@ -2056,6 +2077,7 @@ class CActiveRelation extends CBaseActiveRelation
* Merges this relation with a criteria specified dynamically.
* @param array $criteria the dynamically specified criteria
* @param boolean $fromScope whether the criteria to be merged is from scopes
+ * @return CActiveRelation
* @since 1.0.5
*/
public function mergeWith($criteria,$fromScope=false)
@@ -2095,6 +2117,8 @@ class CActiveRelation extends CBaseActiveRelation
if(isset($criteria['together']))
$this->together=$criteria['together'];
+
+ return $this;
}
}
@@ -2151,6 +2175,7 @@ class CHasManyRelation extends CActiveRelation
* Merges this relation with a criteria specified dynamically.
* @param array $criteria the dynamically specified criteria
* @param boolean $fromScope whether the criteria to be merged is from scopes
+ * @return CHasManyRelation
* @since 1.0.5
*/
public function mergeWith($criteria,$fromScope=false)
@@ -2166,6 +2191,8 @@ class CHasManyRelation extends CActiveRelation
if(isset($criteria['index']))
$this->index=$criteria['index'];
+
+ return $this;
}
}
@@ -2249,7 +2276,7 @@ class CActiveRecordMetaData
* @throws CDbException
* @param string $name $name Name of the relation.
* @param array $config $config Relation parameters.
- * @return void
+ * @return CActiveRecordMetaData
* @since 1.1.2
*/
public function addRelation($name,$config)
@@ -2258,6 +2285,8 @@ class CActiveRecordMetaData
$this->relations[$name]=new $config[0]($name,$config[1],$config[2],array_slice($config,3));
else
throw new CDbException(Yii::t('yii','Active record "{class}" has an invalid configuration for relation "{relation}". It must specify the relation type, the related active record class and the foreign key.', array('{class}'=>get_class($this->_model),'{relation}'=>$name)));
+
+ return $this;
}
/**
@@ -2276,11 +2305,12 @@ class CActiveRecordMetaData
* Deletes a relation with specified name.
*
* @param string $name $name
- * @return void
+ * @return CActiveRecordMetaData
* @since 1.1.2
*/
public function removeRelation($name)
{
unset($this->relations[$name]);
+ return $this;
}
}
diff --git a/framework/db/schema/CDbCommandBuilder.php b/framework/db/schema/CDbCommandBuilder.php
index a784ac526..4c182e157 100644
--- a/framework/db/schema/CDbCommandBuilder.php
+++ b/framework/db/schema/CDbCommandBuilder.php
@@ -421,6 +421,7 @@ class CDbCommandBuilder extends CComponent
* Binds parameter values for an SQL command.
* @param CDbCommand $command database command
* @param array $values values for binding (integer-indexed array for question mark placeholders, string-indexed array for named placeholders)
+ * @return CDbCommandBuilder
*/
public function bindValues($command, $values)
{
@@ -440,6 +441,7 @@ class CDbCommandBuilder extends CComponent
$command->bindValue($name,$value);
}
}
+ return $this;
}
/**
diff --git a/framework/db/schema/CDbCriteria.php b/framework/db/schema/CDbCriteria.php
index eb72a7702..ff7b113d8 100644
--- a/framework/db/schema/CDbCriteria.php
+++ b/framework/db/schema/CDbCriteria.php
@@ -435,6 +435,7 @@ class CDbCriteria extends CComponent
* @param boolean $useAnd whether to use 'AND' to merge condition and having options.
* If false, 'OR' will be used instead. Defaults to 'AND'. This parameter has been
* available since version 1.0.6.
+ * @return CDbCriteria criteria obejct itself
* @since 1.0.5
*/
public function mergeWith($criteria,$useAnd=true)
@@ -561,6 +562,7 @@ class CDbCriteria extends CComponent
$this->with[$k]=$v;
}
}
+ return $this;
}
/**
diff --git a/framework/db/schema/CDbSchema.php b/framework/db/schema/CDbSchema.php
index f5d1c63b0..06cb67d99 100644
--- a/framework/db/schema/CDbSchema.php
+++ b/framework/db/schema/CDbSchema.php
@@ -149,6 +149,7 @@ abstract class CDbSchema extends CComponent
* Refreshes the schema.
* This method resets the loaded table metadata and command builder
* so that they can be recreated to reflect the change of schema.
+ * @return CDbSchema
*/
public function refresh()
{
@@ -166,6 +167,7 @@ abstract class CDbSchema extends CComponent
$this->_tables=array();
$this->_tableNames=array();
$this->_builder=null;
+ return $this;
}
/**
@@ -183,7 +185,6 @@ abstract class CDbSchema extends CComponent
foreach($parts as $i=>$part)
$parts[$i]=$this->quoteSimpleTableName($part);
return implode('.',$parts);
-
}
/**
diff --git a/framework/db/schema/mssql/CMssqlSchema.php b/framework/db/schema/mssql/CMssqlSchema.php
index fa63c96e6..fd1a8f3d8 100644
--- a/framework/db/schema/mssql/CMssqlSchema.php
+++ b/framework/db/schema/mssql/CMssqlSchema.php
@@ -87,6 +87,7 @@ class CMssqlSchema extends CDbSchema
* @param CDbTableSchema $table the table schema whose primary key sequence will be reset
* @param mixed $value the value for the primary key of the next new row inserted. If this is not set,
* the next new row's primary key will have a value 1.
+ * @return CMssqlSchema
* @since 1.1.6
*/
public function resetSequence($table,$value=null)
@@ -100,6 +101,7 @@ class CMssqlSchema extends CDbSchema
$name=strtr($table->rawName,array('['=>'',']'=>''));
$db->createCommand("DBCC CHECKIDENT ('$name', RESEED, $value)")->execute();
}
+ return $this;
}
private $_normalTables=array(); // non-view tables
@@ -107,6 +109,7 @@ class CMssqlSchema extends CDbSchema
* Enables or disables integrity check.
* @param boolean $check whether to turn on or off the integrity check.
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
+ * @return CMssqlSchema
* @since 1.1.6
*/
public function checkIntegrity($check=true,$schema='')
@@ -120,6 +123,7 @@ class CMssqlSchema extends CDbSchema
$tableName=$this->quoteTableName($tableName);
$db->createCommand("ALTER TABLE $tableName $enable CONSTRAINT ALL")->execute();
}
+ return $this;
}
/**
diff --git a/framework/db/schema/mysql/CMysqlSchema.php b/framework/db/schema/mysql/CMysqlSchema.php
index 0f43296a5..d0d28fe80 100644
--- a/framework/db/schema/mysql/CMysqlSchema.php
+++ b/framework/db/schema/mysql/CMysqlSchema.php
@@ -81,6 +81,7 @@ class CMysqlSchema extends CDbSchema
* @param CDbTableSchema $table the table schema whose primary key sequence will be reset
* @param mixed $value the value for the primary key of the next new row inserted. If this is not set,
* the next new row's primary key will have a value 1.
+ * @return CMysqlSchema
* @since 1.1
*/
public function resetSequence($table,$value=null)
@@ -93,17 +94,20 @@ class CMysqlSchema extends CDbSchema
$value=(int)$value;
$this->getDbConnection()->createCommand("ALTER TABLE {$table->rawName} AUTO_INCREMENT=$value")->execute();
}
+ return $this;
}
/**
* Enables or disables integrity check.
* @param boolean $check whether to turn on or off the integrity check.
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
+ * @return CMysqlSchema
* @since 1.1
*/
public function checkIntegrity($check=true,$schema='')
{
$this->getDbConnection()->createCommand('SET FOREIGN_KEY_CHECKS='.($check?1:0))->execute();
+ return $this;
}
/**
diff --git a/framework/db/schema/oci/COciSchema.php b/framework/db/schema/oci/COciSchema.php
index d891f3e3f..94ef233ab 100644
--- a/framework/db/schema/oci/COciSchema.php
+++ b/framework/db/schema/oci/COciSchema.php
@@ -75,10 +75,12 @@ class COciSchema extends CDbSchema
/**
* @param string $schema default schema.
+ * @return COciSchema
*/
public function setDefaultSchema($schema)
{
$this->_defaultSchema=$schema;
+ return $this;
}
/**
diff --git a/framework/db/schema/pgsql/CPgsqlSchema.php b/framework/db/schema/pgsql/CPgsqlSchema.php
index e3408fac6..345628bfb 100644
--- a/framework/db/schema/pgsql/CPgsqlSchema.php
+++ b/framework/db/schema/pgsql/CPgsqlSchema.php
@@ -60,6 +60,7 @@ class CPgsqlSchema extends CDbSchema
* @param CDbTableSchema $table the table schema whose primary key sequence will be reset
* @param mixed $value the value for the primary key of the next new row inserted. If this is not set,
* the next new row's primary key will have a value 1.
+ * @return CPgsqlSchema
* @since 1.1
*/
public function resetSequence($table,$value=null)
@@ -75,12 +76,14 @@ class CPgsqlSchema extends CDbSchema
$value=(int)$value;
$this->getDbConnection()->createCommand("SELECT SETVAL('$seq', $value, false)")->execute();
}
+ return $this;
}
/**
* Enables or disables integrity check.
* @param boolean $check whether to turn on or off the integrity check.
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
+ * @return CPgsqlSchema
* @since 1.1
*/
public function checkIntegrity($check=true,$schema='')
@@ -95,6 +98,7 @@ class CPgsqlSchema extends CDbSchema
$tableName=str_replace('.','"."',$tableName);
$db->createCommand("ALTER TABLE $tableName $enable TRIGGER ALL")->execute();
}
+ return $this;
}
/**
diff --git a/framework/db/schema/sqlite/CSqliteSchema.php b/framework/db/schema/sqlite/CSqliteSchema.php
index 0f88ccf57..12256b42c 100644
--- a/framework/db/schema/sqlite/CSqliteSchema.php
+++ b/framework/db/schema/sqlite/CSqliteSchema.php
@@ -44,6 +44,7 @@ class CSqliteSchema extends CDbSchema
* @param CDbTableSchema $table the table schema whose primary key sequence will be reset
* @param mixed $value the value for the primary key of the next new row inserted. If this is not set,
* the next new row's primary key will have a value 1.
+ * @return CSqliteSchema
* @since 1.1
*/
public function resetSequence($table,$value=null)
@@ -56,18 +57,20 @@ class CSqliteSchema extends CDbSchema
$value=(int)$value-1;
$this->getDbConnection()->createCommand("UPDATE sqlite_sequence SET seq='$value' WHERE name='{$table->name}'")->execute();
}
+ return $this;
}
/**
* Enables or disables integrity check.
* @param boolean $check whether to turn on or off the integrity check.
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
+ * @return CSqliteSchema
* @since 1.1
*/
public function checkIntegrity($check=true,$schema='')
{
// SQLite doesn't enforce integrity
- return;
+ return $this;
}
/**
diff --git a/framework/logging/CEmailLogRoute.php b/framework/logging/CEmailLogRoute.php
index b0a32a211..39b9e86e1 100644
--- a/framework/logging/CEmailLogRoute.php
+++ b/framework/logging/CEmailLogRoute.php
@@ -81,6 +81,7 @@ class CEmailLogRoute extends CLogRoute
/**
* @param mixed $value list of destination email addresses. If the value is
* a string, it is assumed to be comma-separated email addresses.
+ * @return CEmailLogRoute
*/
public function setEmails($value)
{
@@ -88,6 +89,7 @@ class CEmailLogRoute extends CLogRoute
$this->_email=$value;
else
$this->_email=preg_split('/[\s,]+/',$value,-1,PREG_SPLIT_NO_EMPTY);
+ return $this;
}
/**
@@ -100,10 +102,12 @@ class CEmailLogRoute extends CLogRoute
/**
* @param string $value email subject.
+ * @return CEmailLogRoute
*/
public function setSubject($value)
{
$this->_subject=$value;
+ return $this;
}
/**
@@ -116,10 +120,12 @@ class CEmailLogRoute extends CLogRoute
/**
* @param string $value send from address of the email
+ * @return CEmailLogRoute
*/
public function setSentFrom($value)
{
$this->_from=$value;
+ return $this;
}
/**
@@ -135,6 +141,7 @@ class CEmailLogRoute extends CLogRoute
* @param mixed $value list of additional headers to use when sending an email.
* If the value is a string, it is assumed to be line break separated headers.
* @since 1.1.4
+ * @return CEmailLogRoute
*/
public function setHeaders($value)
{
@@ -142,5 +149,6 @@ class CEmailLogRoute extends CLogRoute
$this->_headers=$value;
else
$this->_headers=preg_split('/\r\n|\n/',$value,-1,PREG_SPLIT_NO_EMPTY);
+ return $this;
}
}
\ No newline at end of file
diff --git a/framework/logging/CFileLogRoute.php b/framework/logging/CFileLogRoute.php
index 3c46a6734..c40478ca2 100644
--- a/framework/logging/CFileLogRoute.php
+++ b/framework/logging/CFileLogRoute.php
@@ -65,6 +65,7 @@ class CFileLogRoute extends CLogRoute
/**
* @param string $value directory for storing log files.
+ * @return CFileLogRoute
* @throws CException if the path is invalid
*/
public function setLogPath($value)
@@ -73,6 +74,7 @@ class CFileLogRoute extends CLogRoute
if($this->_logPath===false || !is_dir($this->_logPath) || !is_writable($this->_logPath))
throw new CException(Yii::t('yii','CFileLogRoute.logPath "{path}" does not point to a valid directory. Make sure the directory exists and is writable by the Web server process.',
array('{path}'=>$value)));
+ return $this;
}
/**
@@ -85,10 +87,12 @@ class CFileLogRoute extends CLogRoute
/**
* @param string $value log file name
+ * @return CFileLogRoute
*/
public function setLogFile($value)
{
$this->_logFile=$value;
+ return $this;
}
/**
@@ -101,11 +105,13 @@ class CFileLogRoute extends CLogRoute
/**
* @param integer $value maximum log file size in kilo-bytes (KB).
+ * @return CFileLogRoute
*/
public function setMaxFileSize($value)
{
if(($this->_maxFileSize=(int)$value)<1)
$this->_maxFileSize=1;
+ return $this;
}
/**
@@ -118,11 +124,13 @@ class CFileLogRoute extends CLogRoute
/**
* @param integer $value number of files used for rotation.
+ * @return CFileLogRoute
*/
public function setMaxLogFiles($value)
{
if(($this->_maxLogFiles=(int)$value)<1)
$this->_maxLogFiles=1;
+ return $this;
}
/**
diff --git a/framework/logging/CLogRoute.php b/framework/logging/CLogRoute.php
index d16c83df4..a73e7cb6c 100644
--- a/framework/logging/CLogRoute.php
+++ b/framework/logging/CLogRoute.php
@@ -86,6 +86,7 @@ abstract class CLogRoute extends CComponent
* Retrieves filtered log messages from logger for further processing.
* @param CLogger $logger logger instance
* @param boolean $processLogs whether to process the logs after they are collected from the logger
+ * @return CLogRoute
*/
public function collectLogs($logger, $processLogs=false)
{
@@ -97,6 +98,7 @@ abstract class CLogRoute extends CComponent
Yii::createComponent($this->filter)->filter($this->logs);
$this->processLogs($this->logs);
}
+ return $this;
}
/**
diff --git a/framework/logging/CLogRouter.php b/framework/logging/CLogRouter.php
index 0885ea3dc..7cdfa9012 100644
--- a/framework/logging/CLogRouter.php
+++ b/framework/logging/CLogRouter.php
@@ -84,17 +84,20 @@ class CLogRouter extends CApplicationComponent
* class: specifies the class name or alias for the route class.
* name-value pairs: configure the initial property values of the route.
*
+ * @return CLogRouter
*/
public function setRoutes($config)
{
foreach($config as $name=>$route)
$this->_routes[$name]=$route;
+ return $this;
}
/**
* Collects log messages from a logger.
* This method is an event handler to the {@link CLogger::onFlush} event.
* @param CEvent $event event parameter
+ * @return CLogRouter
*/
public function collectLogs($event)
{
@@ -104,12 +107,14 @@ class CLogRouter extends CApplicationComponent
if($route->enabled)
$route->collectLogs($logger,false);
}
+ return $this;
}
/**
* Collects and processes log messages from a logger.
* This method is an event handler to the {@link CApplication::onEndRequest} event.
* @param CEvent $event event parameter
+ * @return CLogRouter
* @since 1.1.0
*/
public function processLogs($event)
@@ -120,5 +125,6 @@ class CLogRouter extends CApplicationComponent
if($route->enabled)
$route->collectLogs($logger,true);
}
+ return $this;
}
}
diff --git a/framework/logging/CLogger.php b/framework/logging/CLogger.php
index 0ed74b68b..e717b148d 100644
--- a/framework/logging/CLogger.php
+++ b/framework/logging/CLogger.php
@@ -63,6 +63,7 @@ class CLogger extends CComponent
* @param string $level level of the message (e.g. 'Trace', 'Warning', 'Error'). It is case-insensitive.
* @param string $category category of the message (e.g. 'system.web'). It is case-insensitive.
* @see getLogs
+ * @return CLogger
*/
public function log($message,$level='info',$category='application')
{
@@ -70,6 +71,7 @@ class CLogger extends CComponent
$this->_logCount++;
if($this->autoFlush>0 && $this->_logCount>=$this->autoFlush)
$this->flush();
+ return $this;
}
/**
@@ -253,6 +255,7 @@ class CLogger extends CComponent
* Removes all recorded messages from the memory.
* This method will raise an {@link onFlush} event.
* The attached event handlers can process the log messages before they are removed.
+ * @return CLogger
* @since 1.1.0
*/
public function flush()
@@ -260,6 +263,7 @@ class CLogger extends CComponent
$this->onFlush(new CEvent($this));
$this->_logs=array();
$this->_logCount=0;
+ return $this;
}
/**
diff --git a/framework/logging/CProfileLogRoute.php b/framework/logging/CProfileLogRoute.php
index 4bd72f83a..cea3c33b3 100644
--- a/framework/logging/CProfileLogRoute.php
+++ b/framework/logging/CProfileLogRoute.php
@@ -59,6 +59,7 @@ class CProfileLogRoute extends CWebLogRoute
/**
* @param string $value the type of the profiling report to display. Valid values include 'summary' and 'callstack'.
+ * @return CProfileLogRoute
*/
public function setReport($value)
{
@@ -67,11 +68,13 @@ class CProfileLogRoute extends CWebLogRoute
else
throw new CException(Yii::t('yii','CProfileLogRoute.report "{report}" is invalid. Valid values include "summary" and "callstack".',
array('{report}'=>$value)));
+ return $this;
}
/**
* Displays the log messages.
* @param array $logs list of log messages
+ * @return CProfileLogRoute
*/
public function processLogs($logs)
{
@@ -83,6 +86,7 @@ class CProfileLogRoute extends CWebLogRoute
$this->displaySummary($logs);
else
$this->displayCallstack($logs);
+ return $this;
}
/**
diff --git a/framework/logging/CWebLogRoute.php b/framework/logging/CWebLogRoute.php
index 3710f05e2..4e041a94e 100644
--- a/framework/logging/CWebLogRoute.php
+++ b/framework/logging/CWebLogRoute.php
@@ -32,14 +32,16 @@ class CWebLogRoute extends CLogRoute
* For example if the ajax call expects a json type result any output from the logger will cause ajax call to fail.
*/
public $ignoreAjaxInFireBug=true;
-
+
/**
* Displays the log messages.
* @param array $logs list of log messages
+ * @return CWebLogRoute
*/
public function processLogs($logs)
{
$this->render('log',$logs);
+ return $this;
}
/**
diff --git a/framework/test/CDbFixtureManager.php b/framework/test/CDbFixtureManager.php
index 626679df9..85f0ed89b 100644
--- a/framework/test/CDbFixtureManager.php
+++ b/framework/test/CDbFixtureManager.php
@@ -132,6 +132,7 @@ class CDbFixtureManager extends CApplicationComponent
* Otherwise, {@link truncateTable} will be invoked to delete all rows in the table
* and reset primary key sequence, if any.
* @param string $tableName the table name
+ * @return CDbFixtureManager
*/
public function resetTable($tableName)
{
@@ -140,6 +141,7 @@ class CDbFixtureManager extends CApplicationComponent
require($initFile);
else
$this->truncateTable($tableName);
+ return $this;
}
/**
@@ -225,11 +227,13 @@ class CDbFixtureManager extends CApplicationComponent
* Enables or disables database integrity check.
* This method may be used to temporarily turn off foreign constraints check.
* @param boolean $check whether to enable database integrity check
+ * @return CDbFixtureManager
*/
public function checkIntegrity($check)
{
foreach($this->schemas as $schema)
$this->getDbConnection()->getSchema()->checkIntegrity($check,$schema);
+ return $this;
}
/**
@@ -237,6 +241,7 @@ class CDbFixtureManager extends CApplicationComponent
* You may need to call {@link checkIntegrity} to turn off integrity check temporarily
* before you call this method.
* @param string $tableName the table name
+ * @return CDbFixtureManager
*/
public function truncateTable($tableName)
{
@@ -249,6 +254,7 @@ class CDbFixtureManager extends CApplicationComponent
}
else
throw new CException("Table '$tableName' does not exist.");
+ return $this;
}
/**
@@ -257,12 +263,14 @@ class CDbFixtureManager extends CApplicationComponent
* before you call this method.
* @param string $schema the schema name. Defaults to empty string, meaning the default database schema.
* @see truncateTable
+ * @return CDbFixtureManager
*/
public function truncateTables($schema='')
{
$tableNames=$this->getDbConnection()->getSchema()->getTableNames($schema);
foreach($tableNames as $tableName)
$this->truncateTable($tableName);
+ return $this;
}
/**
@@ -277,6 +285,7 @@ class CDbFixtureManager extends CApplicationComponent
* and the array values are either AR class names or table names.
* If table names, they must begin with a colon character (e.g. 'Post'
* means an AR class, while ':Post' means a table name).
+ * @return CDbFixtureManager
*/
public function load($fixtures)
{
@@ -313,6 +322,7 @@ class CDbFixtureManager extends CApplicationComponent
}
$schema->checkIntegrity(true);
+ return $this;
}
/**
diff --git a/framework/web/CActiveDataProvider.php b/framework/web/CActiveDataProvider.php
index c2ab79e7d..930f0c4db 100644
--- a/framework/web/CActiveDataProvider.php
+++ b/framework/web/CActiveDataProvider.php
@@ -87,10 +87,12 @@ class CActiveDataProvider extends CDataProvider
* Sets the query criteria.
* @param mixed $value the query criteria. This can be either a CDbCriteria object or an array
* representing the query criteria.
+ * @return CActiveDataProvider
*/
public function setCriteria($value)
{
$this->_criteria=$value instanceof CDbCriteria ? $value : new CDbCriteria($value);
+ return $this;
}
/**
diff --git a/framework/web/CAssetManager.php b/framework/web/CAssetManager.php
index 4d58ed439..cfcb8ab59 100644
--- a/framework/web/CAssetManager.php
+++ b/framework/web/CAssetManager.php
@@ -55,7 +55,7 @@ class CAssetManager extends CApplicationComponent
public $linkAssets=false;
/**
* @var array list of directories and files which should be excluded from the publishing process.
- * Defaults to exclude '.svn' files only. This option has no effect if {@link linkAssets} is enabled.
+ * Defaults to exclude '.svn' files only. This option has no effect if {@link linkAssets} is enabled.
* @since 1.1.6
**/
public $excludeFiles=array('.svn');
@@ -88,6 +88,7 @@ class CAssetManager extends CApplicationComponent
/**
* Sets the root directory storing published asset files.
* @param string $value the root directory storing published asset files
+ * @return CAssetManager
* @throws CException if the base path is invalid
*/
public function setBasePath($value)
@@ -97,6 +98,7 @@ class CAssetManager extends CApplicationComponent
else
throw new CException(Yii::t('yii','CAssetManager.basePath "{path}" is invalid. Please make sure the directory exists and is writable by the Web server process.',
array('{path}'=>$value)));
+ return $this;
}
/**
@@ -115,10 +117,12 @@ class CAssetManager extends CApplicationComponent
/**
* @param string $value the base url that the published asset files can be accessed
+ * @return CAssetManager
*/
public function setBaseUrl($value)
{
$this->_baseUrl=rtrim($value,'/');
+ return $this;
}
/**
diff --git a/framework/web/CClientScript.php b/framework/web/CClientScript.php
index 7d779cd42..2f5970b9d 100644
--- a/framework/web/CClientScript.php
+++ b/framework/web/CClientScript.php
@@ -103,6 +103,7 @@ class CClientScript extends CApplicationComponent
/**
* Cleans all registered scripts.
+ * @return CClientScript
*/
public function reset()
{
@@ -116,6 +117,7 @@ class CClientScript extends CApplicationComponent
$this->linkTags=array();
$this->recordCachingAction('clientScript','reset',array());
+ return $this;
}
/**
@@ -392,10 +394,12 @@ class CClientScript extends CApplicationComponent
* This setter is provided in case when core javascript files are manually published
* to a pre-specified location. This may save asset publishing time for large-scale applications.
* @param string $value the base URL of all core javascript files.
+ * @return CClientScript
*/
public function setCoreScriptUrl($value)
{
$this->_baseUrl=$value;
+ return $this;
}
/**
diff --git a/framework/web/CController.php b/framework/web/CController.php
index 7ce759886..107b3f48a 100644
--- a/framework/web/CController.php
+++ b/framework/web/CController.php
@@ -469,10 +469,12 @@ class CController extends CBaseController
/**
* @param CAction $value the action currently being executed.
+ * @return CController
*/
public function setAction($value)
{
$this->_action=$value;
+ return $this;
}
/**
@@ -961,10 +963,12 @@ class CController extends CBaseController
/**
* @param string $value the page title.
+ * @return CController
*/
public function setPageTitle($value)
{
$this->_pageTitle=$value;
+ return $this;
}
/**
@@ -1156,6 +1160,7 @@ class CController extends CBaseController
* the given value, the state will be removed from persistent storage.
* @see getPageState
* @see CHtml::statefulForm
+ * @return CController
*/
public function setPageState($name,$value,$defaultValue=null)
{
@@ -1168,14 +1173,17 @@ class CController extends CBaseController
$params=func_get_args();
$this->recordCachingAction('','setPageState',$params);
+ return $this;
}
/**
* Removes all page states.
+ * @return CController
*/
public function clearPageStates()
{
$this->_pageStates=array();
+ return $this;
}
/**
diff --git a/framework/web/CDataProvider.php b/framework/web/CDataProvider.php
index d710d9957..b9659f02e 100644
--- a/framework/web/CDataProvider.php
+++ b/framework/web/CDataProvider.php
@@ -47,10 +47,12 @@ abstract class CDataProvider extends CComponent implements IDataProvider
/**
* Sets the provider ID.
* @param string $value the unique ID that uniquely identifies the data provider among all data providers.
+ * @return CDataProvider
*/
public function setId($value)
{
$this->_id=$value;
+ return $this;
}
/**
@@ -72,6 +74,7 @@ abstract class CDataProvider extends CComponent implements IDataProvider
* Sets the pagination for this data provider.
* @param mixed $value the pagination to be used by this data provider. This could be a {@link CPagination} object
* or an array used to configure the pagination object. If this is false, it means the pagination should be disabled.
+ * @return CDataProvider
*/
public function setPagination($value)
{
@@ -83,6 +86,7 @@ abstract class CDataProvider extends CComponent implements IDataProvider
}
else
$this->_pagination=$value;
+ return $this;
}
/**
@@ -104,6 +108,7 @@ abstract class CDataProvider extends CComponent implements IDataProvider
* Sets the sorting for this data provider.
* @param mixed $value the sorting to be used by this data provider. This could be a {@link CSort} object
* or an array used to configure the sorting object. If this is false, it means the sorting should be disabled.
+ * @return CDataProvider
*/
public function setSort($value)
{
@@ -115,6 +120,7 @@ abstract class CDataProvider extends CComponent implements IDataProvider
}
else
$this->_sort=$value;
+ return $this;
}
/**
@@ -132,10 +138,12 @@ abstract class CDataProvider extends CComponent implements IDataProvider
/**
* Sets the data items for this provider.
* @param array $value put the data items into this provider.
+ * @return CDataProvider
*/
public function setData($value)
{
$this->_data=$value;
+ return $this;
}
/**
@@ -154,10 +162,12 @@ abstract class CDataProvider extends CComponent implements IDataProvider
/**
* Sets the data item keys for this provider.
* @param array $value put the data item keys into this provider.
+ * @return CDataProvider
*/
public function setKeys($value)
{
$this->_keys=$value;
+ return $this;
}
/**
@@ -189,10 +199,12 @@ abstract class CDataProvider extends CComponent implements IDataProvider
* Sets the total number of data items.
* This method is provided in case when the total number cannot be determined by {@link calculateTotalItemCount}.
* @param integer $value the total number of data items.
+ * @return CDataProvider
* @since 1.1.1
*/
public function setTotalItemCount($value)
{
$this->_totalItemCount=$value;
+ return $this;
}
}
diff --git a/framework/web/CExtController.php b/framework/web/CExtController.php
index 84065819f..9ed5d3f93 100644
--- a/framework/web/CExtController.php
+++ b/framework/web/CExtController.php
@@ -44,10 +44,12 @@ class CExtController extends CController
/**
* @param string $value the directory containing the view files for this controller.
+ * @return CExtController
* @since 1.0.1
*/
public function setViewPath($value)
{
$this->_viewPath=$value;
+ return $this;
}
}
diff --git a/framework/web/CHttpRequest.php b/framework/web/CHttpRequest.php
index 6400a556a..eb712a0da 100644
--- a/framework/web/CHttpRequest.php
+++ b/framework/web/CHttpRequest.php
@@ -218,10 +218,12 @@ class CHttpRequest extends CApplicationComponent
* This setter is provided in case the schema and hostname cannot be determined
* on certain Web servers.
* @param string $value the schema and host part of the application URL.
+ * @return CHttpRequest
*/
public function setHostInfo($value)
{
$this->_hostInfo=rtrim($value,'/');
+ return $this;
}
/**
@@ -245,10 +247,12 @@ class CHttpRequest extends CApplicationComponent
* By default the URL is determined based on the entry script URL.
* This setter is provided in case you want to change this behavior.
* @param string $value the relative URL for the application
+ * @return CHttpRequest
*/
public function setBaseUrl($value)
{
$this->_baseUrl=$value;
+ return $this;
}
/**
@@ -282,10 +286,12 @@ class CHttpRequest extends CApplicationComponent
* This setter is provided in case the entry script URL cannot be determined
* on certain Web servers.
* @param string $value the relative URL for the application entry script.
+ * @return CHttpRequest
*/
public function setScriptUrl($value)
{
$this->_scriptUrl='/'.trim($value,'/');
+ return $this;
}
/**
@@ -519,12 +525,14 @@ class CHttpRequest extends CApplicationComponent
* This setter is provided in case a custom port is necessary for certain
* server configurations.
* @param integer $value port number.
+ * @return CHttpRequest
* @since 1.1.3
*/
public function setPort($value)
{
$this->_port=(int)$value;
$this->_hostInfo=null;
+ return $this;
}
private $_securePort;
@@ -550,12 +558,14 @@ class CHttpRequest extends CApplicationComponent
* This setter is provided in case a custom port is necessary for certain
* server configurations.
* @param integer $value port number.
+ * @return CHttpRequest
* @since 1.1.3
*/
public function setSecurePort($value)
{
$this->_securePort=(int)$value;
$this->_hostInfo=null;
+ return $this;
}
/**
@@ -869,6 +879,7 @@ class CCookieCollection extends CMap
* operations for each newly added CHttpCookie object.
* @param mixed $name Cookie name.
* @param CHttpCookie $cookie Cookie object.
+ * @return CCookieCollection
* @throws CException if the item to be inserted is not a CHttpCookie object.
*/
public function add($name,$cookie)
@@ -882,6 +893,7 @@ class CCookieCollection extends CMap
}
else
throw new CException(Yii::t('yii','CHttpCookieCollection can only hold CHttpCookie objects.'));
+ return $this;
}
/**
diff --git a/framework/web/CHttpSession.php b/framework/web/CHttpSession.php
index a9156dfba..8017eb116 100644
--- a/framework/web/CHttpSession.php
+++ b/framework/web/CHttpSession.php
@@ -139,10 +139,12 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
/**
* @param string $value the session ID for the current session
+ * @return CHttpSession
*/
public function setSessionID($value)
{
session_id($value);
+ return $this;
}
/**
@@ -155,10 +157,12 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
/**
* @param string $value the session name for the current session, must be an alphanumeric string, defaults to PHPSESSID
+ * @return CHttpSession
*/
public function setSessionName($value)
{
session_name($value);
+ return $this;
}
/**
@@ -171,6 +175,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
/**
* @param string $value the current session save path
+ * @return CHttpSession
* @throws CException if the path is not a valid directory
*/
public function setSavePath($value)
@@ -180,6 +185,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
else
throw new CException(Yii::t('yii','CHttpSession.savePath "{path}" is not a valid directory.',
array('{path}'=>$value)));
+ return $this;
}
/**
@@ -196,6 +202,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
* The effect of this method only lasts for the duration of the script.
* Call this method before the session starts.
* @param array $value cookie parameters, valid keys include: lifetime, path, domain, secure.
+ * @return CHttpSession
* @see http://us2.php.net/manual/en/function.session-set-cookie-params.php
*/
public function setCookieParams($value)
@@ -207,6 +214,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
session_set_cookie_params($lifetime,$path,$domain,$secure,$httponly);
else
session_set_cookie_params($lifetime,$path,$domain,$secure);
+ return $this;
}
/**
@@ -224,6 +232,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
/**
* @param string $value how to use cookie to store session ID. Valid values include 'none', 'allow' and 'only'.
+ * @return CHttpSession
*/
public function setCookieMode($value)
{
@@ -241,6 +250,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
}
else
throw new CException(Yii::t('yii','CHttpSession.cookieMode can only be "none", "allow" or "only".'));
+ return $this;
}
/**
@@ -253,6 +263,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
/**
* @param integer $value the probability (percentage) that the gc (garbage collection) process is started on every session initialization.
+ * @return CHttpSession
* @throws CException if the value is beyond [0,100]
*/
public function setGCProbability($value)
@@ -266,6 +277,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
else
throw new CException(Yii::t('yii','CHttpSession.gcProbability "{value}" is invalid. It must be an integer between 0 and 100.',
array('{value}'=>$value)));
+ return $this;
}
/**
@@ -278,10 +290,12 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
/**
* @param boolean $value whether transparent sid support is enabled or not.
+ * @return CHttpSession
*/
public function setUseTransparentSessionID($value)
{
ini_set('session.use_trans_sid',$value?'1':'0');
+ return $this;
}
/**
@@ -294,10 +308,12 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
/**
* @param integer $value the number of seconds after which data will be seen as 'garbage' and cleaned up
+ * @return CHttpSession
*/
public function setTimeout($value)
{
ini_set('session.gc_maxlifetime',$value);
+ return $this;
}
/**
@@ -442,10 +458,12 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
* Note, if the specified name already exists, the old value will be removed first.
* @param mixed $key session variable name
* @param mixed $value session variable value
+ * @return CHttpSession
*/
public function add($key,$value)
{
$_SESSION[$key]=$value;
+ return $this;
}
/**
@@ -467,11 +485,13 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar
/**
* Removes all session variables
+ * @return CHttpSession
*/
public function clear()
{
foreach(array_keys($_SESSION) as $key)
unset($_SESSION[$key]);
+ return $this;
}
/**
diff --git a/framework/web/CPagination.php b/framework/web/CPagination.php
index bf3df7bd6..ee8c20b28 100644
--- a/framework/web/CPagination.php
+++ b/framework/web/CPagination.php
@@ -112,11 +112,13 @@ class CPagination extends CComponent
/**
* @param integer $value number of items in each page
+ * @return CPagination
*/
public function setPageSize($value)
{
if(($this->_pageSize=$value)<=0)
$this->_pageSize=self::DEFAULT_PAGE_SIZE;
+ return $this;
}
/**
@@ -129,11 +131,13 @@ class CPagination extends CComponent
/**
* @param integer $value total number of items.
+ * @return CPagination
*/
public function setItemCount($value)
{
if(($this->_itemCount=$value)<0)
$this->_itemCount=0;
+ return $this;
}
/**
@@ -172,11 +176,13 @@ class CPagination extends CComponent
/**
* @param integer $value the zero-based index of the current page.
+ * @return CPagination
*/
public function setCurrentPage($value)
{
$this->_currentPage=$value;
$_GET[$this->pageVar]=$value+1;
+ return $this;
}
/**
@@ -203,12 +209,14 @@ class CPagination extends CComponent
/**
* Applies LIMIT and OFFSET to the specified query criteria.
* @param CDbCriteria $criteria the query criteria that should be applied with the limit
+ * @return CPagination
* @since 1.0.1
*/
public function applyLimit($criteria)
{
$criteria->limit=$this->getLimit();
$criteria->offset=$this->getOffset();
+ return $this;
}
/**
diff --git a/framework/web/CSort.php b/framework/web/CSort.php
index 5319a9eda..1224066b3 100644
--- a/framework/web/CSort.php
+++ b/framework/web/CSort.php
@@ -194,6 +194,7 @@ class CSort extends CComponent
* They will be put in the ORDER BY clause. If the criteria already has non-empty {@link CDbCriteria::order} value,
* the new value will be appended to it.
* @param CDbCriteria $criteria the query criteria
+ * @return CSort
*/
public function applyOrder($criteria)
{
@@ -204,6 +205,7 @@ class CSort extends CComponent
$criteria->order.=', ';
$criteria->order.=$order;
}
+ return $this;
}
/**
diff --git a/framework/web/CThemeManager.php b/framework/web/CThemeManager.php
index 9f6dba3da..ef40a6a89 100644
--- a/framework/web/CThemeManager.php
+++ b/framework/web/CThemeManager.php
@@ -98,6 +98,7 @@ class CThemeManager extends CApplicationComponent
/**
* @param string $value the base path for all themes.
+ * @return CThemeManager
* @throws CException if the base path does not exist
*/
public function setBasePath($value)
@@ -105,6 +106,7 @@ class CThemeManager extends CApplicationComponent
$this->_basePath=realpath($value);
if($this->_basePath===false || !is_dir($this->_basePath))
throw new CException(Yii::t('yii','Theme directory "{directory}" does not exist.',array('{directory}'=>$value)));
+ return $this;
}
/**
@@ -119,9 +121,11 @@ class CThemeManager extends CApplicationComponent
/**
* @param string $value the base URL for all themes.
+ * @return CThemeManager
*/
public function setBaseUrl($value)
{
$this->_baseUrl=rtrim($value,'/');
+ return $this;
}
}
diff --git a/framework/web/CUrlManager.php b/framework/web/CUrlManager.php
index a9c5012b6..d01122914 100644
--- a/framework/web/CUrlManager.php
+++ b/framework/web/CUrlManager.php
@@ -204,12 +204,14 @@ class CUrlManager extends CApplicationComponent
* In order to make the new rules effective, this method must be called BEFORE
* {@link CWebApplication::processRequest}.
* @param array $rules new URL rules (pattern=>route).
+ * @return CUrlManager
* @since 1.1.4
*/
public function addRules($rules)
{
foreach($rules as $pattern=>$route)
$this->_rules[]=$this->createUrlRule($route,$pattern);
+ return $this;
}
/**
@@ -430,11 +432,13 @@ class CUrlManager extends CApplicationComponent
* The ending slashes should be stripped off. And you are also responsible to remove the script name
* if you set {@link showScriptName} to be false.
* @param string $value the base URL of the application
+ * @return CUrlManager
* @since 1.1.1
*/
public function setBaseUrl($value)
{
$this->_baseUrl=$value;
+ return $this;
}
/**
@@ -450,6 +454,7 @@ class CUrlManager extends CApplicationComponent
/**
* Sets the URL format.
* @param string $value the URL format. It must be either 'path' or 'get'.
+ * @return CUrlManager
*/
public function setUrlFormat($value)
{
@@ -457,6 +462,7 @@ class CUrlManager extends CApplicationComponent
$this->_urlFormat=$value;
else
throw new CException(Yii::t('yii','CUrlManager.UrlFormat must be either "path" or "get".'));
+ return $this;
}
}
diff --git a/framework/web/CWebApplication.php b/framework/web/CWebApplication.php
index 64ad558da..06a188233 100644
--- a/framework/web/CWebApplication.php
+++ b/framework/web/CWebApplication.php
@@ -240,10 +240,12 @@ class CWebApplication extends CApplication
/**
* @param string $value the theme name
+ * @return CWebApplication
*/
public function setTheme($value)
{
$this->_theme=$value;
+ return $this;
}
/**
@@ -306,10 +308,12 @@ class CWebApplication extends CApplication
/**
* @param string $value the homepage URL
+ * @return CWebApplication
*/
public function setHomeUrl($value)
{
$this->_homeUrl=$value;
+ return $this;
}
/**
@@ -438,11 +442,13 @@ class CWebApplication extends CApplication
/**
* @param CController $value the currently active controller
+ * @return CWebApplication
* @since 1.0.6
*/
public function setController($value)
{
$this->_controller=$value;
+ return $this;
}
/**
@@ -458,6 +464,7 @@ class CWebApplication extends CApplication
/**
* @param string $value the directory that contains the controller classes.
+ * @return CWebApplication
* @throws CException if the directory is invalid
*/
public function setControllerPath($value)
@@ -465,6 +472,7 @@ class CWebApplication extends CApplication
if(($this->_controllerPath=realpath($value))===false || !is_dir($this->_controllerPath))
throw new CException(Yii::t('yii','The controller path "{path}" is not a valid directory.',
array('{path}'=>$value)));
+ return $this;
}
/**
@@ -480,6 +488,7 @@ class CWebApplication extends CApplication
/**
* @param string $path the root directory of view files.
+ * @return CWebApplication
* @throws CException if the directory does not exist.
*/
public function setViewPath($path)
@@ -487,6 +496,7 @@ class CWebApplication extends CApplication
if(($this->_viewPath=realpath($path))===false || !is_dir($this->_viewPath))
throw new CException(Yii::t('yii','The view path "{path}" is not a valid directory.',
array('{path}'=>$path)));
+ return $this;
}
/**
@@ -502,6 +512,7 @@ class CWebApplication extends CApplication
/**
* @param string $path the root directory of system view files.
+ * @return CWebApplication
* @throws CException if the directory does not exist.
*/
public function setSystemViewPath($path)
@@ -509,6 +520,7 @@ class CWebApplication extends CApplication
if(($this->_systemViewPath=realpath($path))===false || !is_dir($this->_systemViewPath))
throw new CException(Yii::t('yii','The system view path "{path}" is not a valid directory.',
array('{path}'=>$path)));
+ return $this;
}
/**
@@ -524,6 +536,7 @@ class CWebApplication extends CApplication
/**
* @param string $path the root directory of layout files.
+ * @return CWebApplication
* @throws CException if the directory does not exist.
*/
public function setLayoutPath($path)
@@ -531,6 +544,7 @@ class CWebApplication extends CApplication
if(($this->_layoutPath=realpath($path))===false || !is_dir($this->_layoutPath))
throw new CException(Yii::t('yii','The layout path "{path}" is not a valid directory.',
array('{path}'=>$path)));
+ return $this;
}
/**
diff --git a/framework/web/CWebModule.php b/framework/web/CWebModule.php
index 18bec05ad..b660977ab 100644
--- a/framework/web/CWebModule.php
+++ b/framework/web/CWebModule.php
@@ -92,6 +92,7 @@ class CWebModule extends CModule
/**
* @param string $value the directory that contains the controller classes.
+ * @return CWebModule
* @throws CException if the directory is invalid
*/
public function setControllerPath($value)
@@ -99,6 +100,7 @@ class CWebModule extends CModule
if(($this->_controllerPath=realpath($value))===false || !is_dir($this->_controllerPath))
throw new CException(Yii::t('yii','The controller path "{path}" is not a valid directory.',
array('{path}'=>$value)));
+ return $this;
}
/**
@@ -114,6 +116,7 @@ class CWebModule extends CModule
/**
* @param string $path the root directory of view files.
+ * @return CWebModule
* @throws CException if the directory does not exist.
*/
public function setViewPath($path)
@@ -121,6 +124,7 @@ class CWebModule extends CModule
if(($this->_viewPath=realpath($path))===false || !is_dir($this->_viewPath))
throw new CException(Yii::t('yii','The view path "{path}" is not a valid directory.',
array('{path}'=>$path)));
+ return $this;
}
/**
@@ -136,6 +140,7 @@ class CWebModule extends CModule
/**
* @param string $path the root directory of layout files.
+ * @return CWebModule
* @throws CException if the directory does not exist.
*/
public function setLayoutPath($path)
@@ -143,6 +148,7 @@ class CWebModule extends CModule
if(($this->_layoutPath=realpath($path))===false || !is_dir($this->_layoutPath))
throw new CException(Yii::t('yii','The layout path "{path}" is not a valid directory.',
array('{path}'=>$path)));
+ return $this;
}
/**
diff --git a/framework/web/auth/CAccessControlFilter.php b/framework/web/auth/CAccessControlFilter.php
index e57765ab6..d70dfd6fc 100644
--- a/framework/web/auth/CAccessControlFilter.php
+++ b/framework/web/auth/CAccessControlFilter.php
@@ -75,6 +75,7 @@ class CAccessControlFilter extends CFilter
/**
* @param array $rules list of access rules.
+ * @return CAccessControlFilter
*/
public function setRules($rules)
{
@@ -94,6 +95,7 @@ class CAccessControlFilter extends CFilter
$this->_rules[]=$r;
}
}
+ return $this;
}
/**
diff --git a/framework/web/auth/CAuthAssignment.php b/framework/web/auth/CAuthAssignment.php
index b37d70b07..4dfffbd5a 100644
--- a/framework/web/auth/CAuthAssignment.php
+++ b/framework/web/auth/CAuthAssignment.php
@@ -70,6 +70,7 @@ class CAuthAssignment extends CComponent
/**
* @param string $value the business rule associated with this assignment
+ * @return CAuthAssignment
*/
public function setBizRule($value)
{
@@ -78,6 +79,7 @@ class CAuthAssignment extends CComponent
$this->_bizRule=$value;
$this->_auth->saveAuthAssignment($this);
}
+ return $this;
}
/**
@@ -90,6 +92,7 @@ class CAuthAssignment extends CComponent
/**
* @param mixed $value additional data for this assignment
+ * @return CAuthAssignment
*/
public function setData($value)
{
@@ -98,5 +101,6 @@ class CAuthAssignment extends CComponent
$this->_data=$value;
$this->_auth->saveAuthAssignment($this);
}
+ return $this;
}
}
\ No newline at end of file
diff --git a/framework/web/auth/CAuthItem.php b/framework/web/auth/CAuthItem.php
index 7043f1931..0ea18fa44 100644
--- a/framework/web/auth/CAuthItem.php
+++ b/framework/web/auth/CAuthItem.php
@@ -102,6 +102,7 @@ class CAuthItem extends CComponent
/**
* @param string $value the item name
+ * @return CAuthItem
*/
public function setName($value)
{
@@ -111,6 +112,7 @@ class CAuthItem extends CComponent
$this->_name=$value;
$this->_auth->saveAuthItem($this,$oldName);
}
+ return $this;
}
/**
@@ -123,6 +125,7 @@ class CAuthItem extends CComponent
/**
* @param string $value the item description
+ * @return CAuthItem
*/
public function setDescription($value)
{
@@ -131,6 +134,7 @@ class CAuthItem extends CComponent
$this->_description=$value;
$this->_auth->saveAuthItem($this);
}
+ return $this;
}
/**
@@ -143,6 +147,7 @@ class CAuthItem extends CComponent
/**
* @param string $value the business rule associated with this item
+ * @return CAuthItem
*/
public function setBizRule($value)
{
@@ -151,6 +156,7 @@ class CAuthItem extends CComponent
$this->_bizRule=$value;
$this->_auth->saveAuthItem($this);
}
+ return $this;
}
/**
@@ -163,6 +169,7 @@ class CAuthItem extends CComponent
/**
* @param string $value the business rule associated with this item
+ * @return CAuthItem
*/
public function setData($value)
{
@@ -171,6 +178,7 @@ class CAuthItem extends CComponent
$this->_data=$value;
$this->_auth->saveAuthItem($this);
}
+ return $this;
}
/**
@@ -241,7 +249,7 @@ class CAuthItem extends CComponent
*/
public function revoke($userId)
{
- $this->_auth->revoke($this->_name,$userId);
+ return $this->_auth->revoke($this->_name,$userId);
}
/**
diff --git a/framework/web/auth/CBaseUserIdentity.php b/framework/web/auth/CBaseUserIdentity.php
index 3691ad00f..2022faa75 100644
--- a/framework/web/auth/CBaseUserIdentity.php
+++ b/framework/web/auth/CBaseUserIdentity.php
@@ -77,10 +77,12 @@ abstract class CBaseUserIdentity extends CComponent implements IUserIdentity
* Sets an array of presistent states.
*
* @param array $states the identity states that should be persisted.
+ * @return CBaseUserIdentity
*/
public function setPersistentStates($states)
{
$this->_state = $states;
+ return $this;
}
/**
@@ -108,19 +110,23 @@ abstract class CBaseUserIdentity extends CComponent implements IUserIdentity
* Sets the named state with a given value.
* @param string $name the name of the state
* @param mixed $value the value of the named state
+ * @return CBaseUserIdentity
*/
public function setState($name,$value)
{
$this->_state[$name]=$value;
+ return $this;
}
/**
* Removes the specified state.
* @param string $name the name of the state
+ * @return CBaseUserIdentity
* @since 1.0.8
*/
public function clearState($name)
{
unset($this->_state[$name]);
+ return $this;
}
}
diff --git a/framework/web/auth/CDbAuthManager.php b/framework/web/auth/CDbAuthManager.php
index 607b963e0..ea75b1f3e 100644
--- a/framework/web/auth/CDbAuthManager.php
+++ b/framework/web/auth/CDbAuthManager.php
@@ -116,6 +116,7 @@ class CDbAuthManager extends CAuthManager
* Adds an item as a child of another item.
* @param string $itemName the parent item name
* @param string $childName the child item name
+ * @return CDbAuthManager
* @throws CException if either parent or child doesn't exist or if a loop has been detected.
*/
public function addItemChild($itemName,$childName)
@@ -153,6 +154,7 @@ class CDbAuthManager extends CAuthManager
}
else
throw new CException(Yii::t('yii','Either "{parent}" or "{child}" does not exist.',array('{child}'=>$childName,'{parent}'=>$itemName)));
+ return $this;
}
/**
@@ -315,6 +317,7 @@ class CDbAuthManager extends CAuthManager
/**
* Saves the changes to an authorization assignment.
* @param CAuthAssignment $assignment the assignment that has been changed.
+ * @return CDbAuthManager
*/
public function saveAuthAssignment($assignment)
{
@@ -325,6 +328,7 @@ class CDbAuthManager extends CAuthManager
$command->bindValue(':itemname',$assignment->getItemName());
$command->bindValue(':userid',$assignment->getUserId());
$command->execute();
+ return $this;
}
/**
@@ -455,6 +459,7 @@ class CDbAuthManager extends CAuthManager
* Saves an authorization item to persistent storage.
* @param CAuthItem $item the item to be saved.
* @param string $oldName the old item name. If null, it means the item name is not changed.
+ * @return CDbAuthManager
*/
public function saveAuthItem($item,$oldName=null)
{
@@ -486,6 +491,7 @@ class CDbAuthManager extends CAuthManager
$command->bindValue(':bizrule',$item->getBizRule());
$command->bindValue(':data',serialize($item->getData()));
$command->execute();
+ return $this;
}
/**
@@ -497,20 +503,24 @@ class CDbAuthManager extends CAuthManager
/**
* Removes all authorization data.
+ * @return CDbAuthManager
*/
public function clearAll()
{
$this->clearAuthAssignments();
$this->db->createCommand("DELETE FROM {$this->itemChildTable}")->execute();
$this->db->createCommand("DELETE FROM {$this->itemTable}")->execute();
+ return $this;
}
/**
* Removes all authorization assignments.
+ * @return CDbAuthManager
*/
public function clearAuthAssignments()
{
$this->db->createCommand("DELETE FROM {$this->assignmentTable}")->execute();
+ return $this;
}
/**
diff --git a/framework/web/auth/CPhpAuthManager.php b/framework/web/auth/CPhpAuthManager.php
index 94982671d..a03c8699e 100644
--- a/framework/web/auth/CPhpAuthManager.php
+++ b/framework/web/auth/CPhpAuthManager.php
@@ -90,6 +90,7 @@ class CPhpAuthManager extends CAuthManager
* Adds an item as a child of another item.
* @param string $itemName the parent item name
* @param string $childName the child item name
+ * @return CPhpAuthManager
* @throws CException if either parent or child doesn't exist or if a loop has been detected.
*/
public function addItemChild($itemName,$childName)
@@ -106,6 +107,7 @@ class CPhpAuthManager extends CAuthManager
throw new CException(Yii::t('yii','The item "{parent}" already has a child "{child}".',
array('{child}'=>$childName,'{parent}'=>$itemName)));
$this->_children[$itemName][$childName]=$this->_items[$childName];
+ return $this;
}
/**
@@ -318,6 +320,7 @@ class CPhpAuthManager extends CAuthManager
* Saves an authorization item to persistent storage.
* @param CAuthItem $item the item to be saved.
* @param string $oldName the old item name. If null, it means the item name is not changed.
+ * @return CPhpAuthManager
*/
public function saveAuthItem($item,$oldName=null)
{
@@ -352,6 +355,7 @@ class CPhpAuthManager extends CAuthManager
}
}
}
+ return $this;
}
/**
@@ -366,6 +370,7 @@ class CPhpAuthManager extends CAuthManager
* Saves authorization data into persistent storage.
* If any change is made to the authorization data, please make
* sure you call this method to save the changed data into persistent storage.
+ * @return CPhpAuthManager
*/
public function save()
{
@@ -400,10 +405,12 @@ class CPhpAuthManager extends CAuthManager
}
$this->saveToFile($items,$this->authFile);
+ return $this;
}
/**
* Loads authorization data.
+ * @return CPhpAuthManager
*/
public function load()
{
@@ -432,24 +439,29 @@ class CPhpAuthManager extends CAuthManager
}
}
}
+ return $this;
}
/**
* Removes all authorization data.
+ * @return CPhpAuthManager
*/
public function clearAll()
{
$this->clearAuthAssignments();
$this->_children=array();
$this->_items=array();
+ return $this;
}
/**
* Removes all authorization assignments.
+ * @return CPhpAuthManager
*/
public function clearAuthAssignments()
{
$this->_assignments=array();
+ return $this;
}
/**
diff --git a/framework/web/auth/CWebUser.php b/framework/web/auth/CWebUser.php
index 444b4cc11..4eb376222 100644
--- a/framework/web/auth/CWebUser.php
+++ b/framework/web/auth/CWebUser.php
@@ -183,6 +183,7 @@ class CWebUser extends CApplicationComponent implements IWebUser
* @param integer $duration number of seconds that the user can remain in logged-in status. Defaults to 0, meaning login till the user closes the browser.
* If greater than 0, cookie-based login will be used. In this case, {@link allowAutoLogin}
* must be set true, otherwise an exception will be thrown.
+ * @return CWebUser
*/
public function login($identity,$duration=0)
{
@@ -203,6 +204,7 @@ class CWebUser extends CApplicationComponent implements IWebUser
$this->afterLogin(false);
}
+ return $this;
}
/**
@@ -213,6 +215,7 @@ class CWebUser extends CApplicationComponent implements IWebUser
* then {@link clearStates} will be called, which removes only the data stored via {@link setState}.
* This parameter has been available since version 1.0.7. Before 1.0.7, the behavior
* is to destroy the whole session.
+ * @return CWebUser
*/
public function logout($destroySession=true)
{
@@ -235,6 +238,7 @@ class CWebUser extends CApplicationComponent implements IWebUser
$this->clearStates();
$this->afterLogout();
}
+ return $this;
}
/**
@@ -255,10 +259,12 @@ class CWebUser extends CApplicationComponent implements IWebUser
/**
* @param mixed $value the unique identifier for the user. If null, it means the user is a guest.
+ * @return CWebUser
*/
public function setId($value)
{
$this->setState('__id',$value);
+ return $this;
}
/**
@@ -278,10 +284,12 @@ class CWebUser extends CApplicationComponent implements IWebUser
* Sets the unique identifier for the user (e.g. username).
* @param string $value the user name.
* @see getName
+ * @return CWebUser
*/
public function setName($value)
{
$this->setState('__name',$value);
+ return $this;
}
/**
@@ -300,10 +308,12 @@ class CWebUser extends CApplicationComponent implements IWebUser
/**
* @param string $value the URL that the user should be redirected to after login.
+ * @return CWebUser
*/
public function setReturnUrl($value)
{
$this->setState('__returnUrl',$value);
+ return $this;
}
/**
@@ -492,11 +502,13 @@ class CWebUser extends CApplicationComponent implements IWebUser
/**
* @param string $value a prefix for the name of the session variables storing user session data.
+ * @return CWebUser
* @since 1.0.9
*/
public function setStateKeyPrefix($value)
{
$this->_keyPrefix=$value;
+ return $this;
}
/**
@@ -533,6 +545,7 @@ class CWebUser extends CApplicationComponent implements IWebUser
* @param mixed $defaultValue default value. If $value===$defaultValue, the variable will be
* removed from the session
* @see getState
+ * @return CWebUser
*/
public function setState($key,$value,$defaultValue=null)
{
@@ -541,6 +554,7 @@ class CWebUser extends CApplicationComponent implements IWebUser
unset($_SESSION[$key]);
else
$_SESSION[$key]=$value;
+ return $this;
}
/**
@@ -558,6 +572,7 @@ class CWebUser extends CApplicationComponent implements IWebUser
/**
* Clears all user identity information from persistent storage.
* This will remove the data stored via {@link setState}.
+ * @return CWebUser
*/
public function clearStates()
{
@@ -569,6 +584,7 @@ class CWebUser extends CApplicationComponent implements IWebUser
if(!strncmp($key,$prefix,$n))
unset($_SESSION[$key]);
}
+ return $this;
}
/**
@@ -623,6 +639,7 @@ class CWebUser extends CApplicationComponent implements IWebUser
* @param mixed $value flash message
* @param mixed $defaultValue if this value is the same as the flash message, the flash message
* will be removed. (Therefore, you can use setFlash('key',null) to remove a flash message.)
+ * @return CWebUser
*/
public function setFlash($key,$value,$defaultValue=null)
{
@@ -633,6 +650,7 @@ class CWebUser extends CApplicationComponent implements IWebUser
else
$counters[$key]=0;
$this->setState(self::FLASH_COUNTERS,$counters,array());
+ return $this;
}
/**
diff --git a/framework/web/filters/CFilterChain.php b/framework/web/filters/CFilterChain.php
index c221380a1..6bd657ba3 100644
--- a/framework/web/filters/CFilterChain.php
+++ b/framework/web/filters/CFilterChain.php
@@ -105,6 +105,7 @@ class CFilterChain extends CList
* only objects implementing {@link IFilter} can be added to the list.
* @param integer $index the specified position.
* @param mixed $item new item
+ * @return CFilterChain
* @throws CException If the index specified exceeds the bound or the list is read-only, or the item is not an {@link IFilter} instance.
*/
public function insertAt($index,$item)
@@ -113,6 +114,7 @@ class CFilterChain extends CList
parent::insertAt($index,$item);
else
throw new CException(Yii::t('yii','CFilterChain can only take objects implementing the IFilter interface.'));
+ return $this;
}
/**
diff --git a/framework/web/form/CForm.php b/framework/web/form/CForm.php
index 32ebe6ecb..919f6fb73 100644
--- a/framework/web/form/CForm.php
+++ b/framework/web/form/CForm.php
@@ -201,6 +201,7 @@ class CForm extends CFormElement implements ArrayAccess
* This method will go through all models associated with this form and its sub-forms
* and massively assign the submitted data to the models.
* @see submitted
+ * @return CForm
*/
public function loadData()
{
@@ -220,6 +221,7 @@ class CForm extends CFormElement implements ArrayAccess
if($element instanceof self)
$element->loadData();
}
+ return $this;
}
/**
@@ -276,10 +278,12 @@ class CForm extends CFormElement implements ArrayAccess
/**
* @param CModel $model the model to be associated with this form
+ * @return CForm
*/
public function setModel($model)
{
$this->_model=$model;
+ return $this;
}
/**
@@ -321,12 +325,14 @@ class CForm extends CFormElement implements ArrayAccess
* (when 'type' is a string ending with 'Form'), or a {@link CFormInputElement} object in
* all other cases.
* @param array $elements the button configurations
+ * @return CForm
*/
public function setElements($elements)
{
$collection=$this->getElements();
foreach($elements as $name=>$config)
$collection->add($name,$config);
+ return $this;
}
/**
@@ -348,12 +354,14 @@ class CForm extends CFormElement implements ArrayAccess
* Each button configuration array consists of name-value pairs that are used to initialize
* a {@link CFormButtonElement} object.
* @param array $buttons the button configurations
+ * @return CForm
*/
public function setButtons($buttons)
{
$collection=$this->getButtons();
foreach($buttons as $name=>$config)
$collection->add($name,$config);
+ return $this;
}
/**
diff --git a/framework/web/form/CFormButtonElement.php b/framework/web/form/CFormButtonElement.php
index ed0ec8007..a60d8ebb6 100644
--- a/framework/web/form/CFormButtonElement.php
+++ b/framework/web/form/CFormButtonElement.php
@@ -82,10 +82,12 @@ class CFormButtonElement extends CFormElement
/**
* @param string $value scenario names separated by commas.
+ * @return CFormButtonElement
*/
public function setOn($value)
{
$this->_on=preg_split('/[\s,]+/',$value,-1,PREG_SPLIT_NO_EMPTY);
+ return $this;
}
/**
diff --git a/framework/web/form/CFormElement.php b/framework/web/form/CFormElement.php
index 061fb919d..b991944d3 100644
--- a/framework/web/form/CFormElement.php
+++ b/framework/web/form/CFormElement.php
@@ -110,6 +110,7 @@ abstract class CFormElement extends CComponent
* representing the property names and their initial values.
* It can also be a string representing the file name of the PHP script
* that returns a configuration array.
+ * @return CFormElement
*/
public function configure($config)
{
@@ -120,6 +121,7 @@ abstract class CFormElement extends CComponent
foreach($config as $name=>$value)
$this->$name=$value;
}
+ return $this;
}
/**
@@ -136,10 +138,12 @@ abstract class CFormElement extends CComponent
/**
* @param boolean $value whether this element is visible and should be rendered.
+ * @return CFormElement
*/
public function setVisible($value)
{
$this->_visible=$value;
+ return $this;
}
/**
diff --git a/framework/web/form/CFormElementCollection.php b/framework/web/form/CFormElementCollection.php
index 5d22f7d12..66440d82a 100644
--- a/framework/web/form/CFormElementCollection.php
+++ b/framework/web/form/CFormElementCollection.php
@@ -53,6 +53,7 @@ class CFormElementCollection extends CMap
* can be stored in this collection.
* @param mixed $key key
* @param mixed $value value
+ * @return CFormElementCollection
* @throws CException if the value is invalid.
*/
public function add($key,$value)
@@ -98,15 +99,18 @@ class CFormElementCollection extends CMap
$element=new CFormStringElement(array('content'=>$value),$this->_form);
parent::add($key,$element);
$this->_form->addedElement($key,$element,$this->_forButtons);
+ return $this;
}
/**
* Removes the specified element by key.
* @param string $key the name of the element to be removed from the collection
+ * @return CFormElementCollection
*/
public function remove($key)
{
if(($item=parent::remove($key))!==null)
$this->_form->removedElement($key,$item,$this->_forButtons);
+ return $this;
}
}
diff --git a/framework/web/form/CFormInputElement.php b/framework/web/form/CFormInputElement.php
index ac2bc0a8b..ff9e42b48 100644
--- a/framework/web/form/CFormInputElement.php
+++ b/framework/web/form/CFormInputElement.php
@@ -109,10 +109,12 @@ class CFormInputElement extends CFormElement
/**
* @param boolean $value whether this input is required.
+ * @return CFormInputElement
*/
public function setRequired($value)
{
$this->_required=$value;
+ return $this;
}
/**
@@ -129,10 +131,12 @@ class CFormInputElement extends CFormElement
/**
* @param string $value the label for this input
+ * @return CFormInputElement
*/
public function setLabel($value)
{
$this->_label=$value;
+ return $this;
}
/**
diff --git a/framework/web/form/CFormStringElement.php b/framework/web/form/CFormStringElement.php
index a3397bda3..813ef5f59 100644
--- a/framework/web/form/CFormStringElement.php
+++ b/framework/web/form/CFormStringElement.php
@@ -40,10 +40,12 @@ class CFormStringElement extends CFormElement
/**
* @param string $value scenario names separated by commas.
+ * @return CFormStringElement
*/
public function setOn($value)
{
$this->_on=preg_split('/[\s,]+/',$value,-1,PREG_SPLIT_NO_EMPTY);
+ return $this;
}
/**
diff --git a/framework/web/widgets/pagers/CBasePager.php b/framework/web/widgets/pagers/CBasePager.php
index c88265470..c6fba2e61 100644
--- a/framework/web/widgets/pagers/CBasePager.php
+++ b/framework/web/widgets/pagers/CBasePager.php
@@ -36,10 +36,12 @@ abstract class CBasePager extends CWidget
/**
* Sets the pagination information used by this pager.
* @param CPagination $pages the pagination information
+ * @return CBasePager
*/
public function setPages($pages)
{
$this->_pages=$pages;
+ return $this;
}
/**
@@ -64,10 +66,12 @@ abstract class CBasePager extends CWidget
/**
* @param integer $value number of items in each page
* @see CPagination::setPageSize
+ * @return CBasePager
*/
public function setPageSize($value)
{
$this->getPages()->setPageSize($value);
+ return $this;
}
/**
@@ -82,10 +86,12 @@ abstract class CBasePager extends CWidget
/**
* @param integer $value total number of items.
* @see CPagination::setItemCount
+ * @return CBasePager
*/
public function setItemCount($value)
{
$this->getPages()->setItemCount($value);
+ return $this;
}
/**
@@ -110,10 +116,12 @@ abstract class CBasePager extends CWidget
/**
* @param integer $value the zero-based index of the current page.
* @see CPagination::setCurrentPage
+ * @return CBasePager
*/
public function setCurrentPage($value)
{
$this->getPages()->setCurrentPage($value);
+ return $this;
}
/**