PHP Class Scalr\Model\Collections\SettingsCollection

Author: N.V.
Inheritance: extends Scalr\Util\ObjectAccess
显示文件 Open project: scalr/scalr Class Usage Examples

Public Methods

Method Description
__clone ( ) Reset referenced fields
__construct ( string $entityClass, array $criteria, array $defaultProperties = [], array $settings = [] ) SettingsCollection
getArrayCopy ( ) : array Get array copy
getEntity ( string $name ) : Scalr\Model\Entity\Setting Gets setting entity
getIterator ( )
getSettingsClass ( ) : string Gets settings class name
load ( ) Loads settings from DB, if some settings already changed - keeps new values
offsetExists ( $offset )
offsetGet ( string $name ) : string | null Gets setting value
offsetSet ( string $name, mixed $setting ) Sets setting value, creates internal entity
save ( ) Saves settings entities to DB
saveSettings ( array $settings ) Saves multiply settings
setCriteria ( array $criteria ) Sets search criteria
setDefaultProperties ( array $defaultProperties ) Sets default values for new entities

Method Details

__clone() public method

Reset referenced fields
public __clone ( )

__construct() public method

SettingsCollection
public __construct ( string $entityClass, array $criteria, array $defaultProperties = [], array $settings = [] )
$entityClass string Entity class name with namespace
$criteria array Search criteria
$defaultProperties array optional Default values for new entities
$settings array optional Initial settings

getArrayCopy() public method

Get array copy
public getArrayCopy ( ) : array
return array A copy of the array, or array of public properties if ArrayIterator refers to an object.

getEntity() public method

Gets setting entity
public getEntity ( string $name ) : Scalr\Model\Entity\Setting
$name string Setting name
return Scalr\Model\Entity\Setting

getIterator() public method

See also: ObjectAccess::getIterator()
public getIterator ( )

getSettingsClass() public method

Gets settings class name
public getSettingsClass ( ) : string
return string Returns the name of settings class

load() public method

Loads settings from DB, if some settings already changed - keeps new values
public load ( )

offsetExists() public method

public offsetExists ( $offset )

offsetGet() public method

Gets setting value
See also: ObjectAccess::offsetGet()
public offsetGet ( string $name ) : string | null
$name string Setting name
return string | null

offsetSet() public method

Sets setting value, creates internal entity
See also: ObjectAccess::offsetSet()
public offsetSet ( string $name, mixed $setting )
$name string Setting name
$setting mixed If $setting is array or object - interprets its fields as entity properties, otherwise - as value

save() public method

Saves settings entities to DB
public save ( )

saveSettings() public method

Saves multiply settings
public saveSettings ( array $settings )
$settings array Name-value settings array

setCriteria() public method

Sets search criteria
public setCriteria ( array $criteria )
$criteria array Search criteria

setDefaultProperties() public method

Sets default values for new entities
public setDefaultProperties ( array $defaultProperties )
$defaultProperties array Default values for new entities