Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CAttributeCollection
  • CConfiguration
  • CList
  • CListIterator
  • CMap
  • CMapIterator
  • CQueue
  • CQueueIterator
  • CStack
  • CStackIterator
  • CTypedList
  • CTypedMap
  • Overview
  • Package
  • Class
  • Tree

Class CConfiguration

CConfiguration represents an array-based configuration.

It can be used to initialize an object's properties.

The configuration data may be obtained from a PHP script. For example,

return array(
    'name'=>'My Application',
    'defaultController'=>'index',
);

Use the following code to load the above configuration data:

$config=new CConfiguration('path/to/config.php');

To apply the configuration to an object, call CConfiguration::applyTo(). Each (key,value) pair in the configuration data is applied to the object like: $object->$key=$value.

Since CConfiguration extends from CMap, it can be used like an associative array. See CMap for more details.

CComponent
Extended by CMap implements IteratorAggregate, ArrayAccess, Countable
Extended by CConfiguration
Package: system\collections
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/collections/CConfiguration.php
Methods summary
public
# __construct( mixed $data = null )

Constructor.

Constructor.

Parameters

$data
mixed
$data if string, it represents a config file (a PHP script returning the configuration as an array); If array, it is config data.

Throws

CException
If data is not null and neither an array nor an iterator.

Overrides

CMap::__construct()
public
# loadFromFile( string $configFile )

Loads configuration data from a file and merges it with the existing configuration.

Loads configuration data from a file and merges it with the existing configuration.

A config file must be a PHP script returning a configuration array (like the following)

return array
(
    'name'=>'My Application',
    'defaultController'=>'index',
);

Parameters

$configFile
string
$configFile configuration file path (if using relative path, be aware of what is the current path)

See

CMap::mergeWith()
public string
# saveAsString( )

Saves the configuration into a string. The string is a valid PHP expression representing the configuration data as an array.

Saves the configuration into a string. The string is a valid PHP expression representing the configuration data as an array.

Returns

string
the string representation of the configuration
public
# applyTo( object $object )

Applies the configuration to an object. Each (key,value) pair in the configuration data is applied to the object like: $object->$key=$value.

Applies the configuration to an object. Each (key,value) pair in the configuration data is applied to the object like: $object->$key=$value.

Parameters

$object
object
$object object to be applied with this configuration
Methods inherited from CMap
add(), clear(), contains(), copyFrom(), count(), getCount(), getIterator(), getKeys(), getReadOnly(), itemAt(), mergeArray(), mergeWith(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), remove(), setReadOnly(), toArray()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Magic properties inherited from CMap
$count, $iterator, $keys, $readOnly
API documentation generated by ApiGen 2.8.0