There are more than 10000 classes inheriting 'yii\base\BaseObject'. Displaying first 10000 results.

Description

BaseObject is the base class that implements the property feature.

A property is defined by a getter method (e.g. getLabel), and/or a setter method (e.g. setLabel). For example, the following getter and setter methods define a property named label:

private $_label;

public function getLabel()
{
return $this->_label;
}

public function setLabel($value)
{
$this->_label = $value;
}

Property names are case-insensitive.

A property can be accessed like a member variable of an object. Reading or writing a property will cause the invocation of the corresponding getter or setter method. For example,

// equivalent to $label = $object->getLabel();
$label = $object->label;
// equivalent to $object->setLabel('abc');
$object->label = 'abc';

If a property has only a getter method and has no setter method, it is considered as read-only. In this case, trying to modify the property value will cause an exception.

One can call [[hasProperty()]], [[canGetProperty()]] and/or [[canSetProperty()]] to check the existence of a property.

Besides the property feature, BaseObject also introduces an important object initialization life cycle. In particular, creating an new instance of BaseObject or its derived class will involve the following life cycles sequentially:

  1. the class constructor is invoked;
  2. object properties are initialized according to the given configuration;
  3. the init() method is invoked.

In the above, both Step 2 and 3 occur at the end of the class constructor. It is recommended that you perform object initialization in the init() method because at that stage, the object configuration is already applied.

In order to ensure the above life cycles, if a child class of BaseObject needs to override the constructor, it should be done like the following:

public function __construct($param1, $param2, ..., $config = [])
{
...
parent::__construct($config);
}

That is, a $config parameter (defaults to []) should be declared as the last parameter of the constructor, and the parent implementation should be called at the end of the constructor.

Type hierarchy

mengxl-cn/db-for-yii2 dev-master
minii/core dev-master
myweishanli/codeigniter-with-yii2 dev-master 1.0.0
leaps/framework dev-master 3.0.x-dev 2.0.34

Class usage:

This class is used in:
Class Package
yii\queue\gii\Generator
marchrainbow/yii2-queue dev-master
yii\queue\gii\Generator
marchrainbow/yii2-queue 1.1
tourze\workerman\yii2\Container
mindongji/workerman-yii2 dev-master
tourze\workerman\yii2\Container
mindongji/workerman-yii2 0.3.5
skeeks\cms\behaviors\RelationalBehavior
skeeks/cms dev-master
skeeks\cms\IHasModel
skeeks/cms v4.x-dev
laco\uploader\storageFile\BaseStorageFile
laco-agency/uploader dev-master
laco\uploader\storageFile\BaseStorageFile
laco-agency/uploader v0.4.0
yii\test\DbFixture
leaps/framework dev-master
yii\console\controllers\BaseMigrateController
leaps/framework dev-master
yii\test\DbFixture
leaps/framework 3.0.x-dev
yii\console\controllers\BaseMigrateController
leaps/framework 3.0.x-dev
yii\test\DbFixture
leaps/framework 2.0.34
yii\console\controllers\BaseMigrateController
leaps/framework 2.0.34