Class CBJsonModel
Base class for JSON models.
-
CFormModel
-
CBJsonModel
Methods summary
public
boolean
|
#
validate( array $attributes = null, boolean $clearErrors = true )
Throw exception if validation fails.
Throw exception if validation fails.
Parameters
- $attributes
array $attributes
- $clearErrors
boolean $clearErrors
Returns
boolean
Throws
CException
|
public
string[]
|
#
getAttributeTypes( )
Types of non-scalar members.
Types of non-scalar members.
Returns
string[]
|
public
CBJsonModel
|
#
copyFrom( array|object $source )
Initialize from source object/array.
Initialize from source object/array.
Parameters
- $source
array|object $source
Returns
|
public
mixed
|
#
toArray( )
Model attributes as array.
Model attributes as array.
Returns
mixed
|
public static
CBJsonModel
|
#
createFromOne( array|object $source )
Clones a source into a json model.
Clones a source into a json model.
Parameters
- $source
array|object $source Source to clone attributes from.
Returns
|
public static
CBJsonModel[]
|
#
createFromMany( array $sources )
Clones an array of sources into an array of json models.
Clones an array of sources into an array of json models.
Original model array keys are preserved in final array.
Parameters
- $sources
array $sources Sources to clone attributes from.
Returns
|
public static
mixed
|
#
resolveObjectRecursively( mixed $inputObject, boolean $doSuppressNulls = false )
Resolve an object to its proper JSON representation.
Resolve an object to its proper JSON representation.
Parameters
- $inputObject
mixed $inputObject
- $doSuppressNulls
boolean $doSuppressNulls If true, null properties are suppressed from result.
Returns
mixed
|