Scalr\Model\Collections\SettingsCollection::setDefaultProperties PHP Method

setDefaultProperties() public method

Sets default values for new entities
public setDefaultProperties ( array $defaultProperties )
$defaultProperties array Default values for new entities
    public function setDefaultProperties(array $defaultProperties)
    {
        $this->defaultProperties = $defaultProperties;
        foreach ($this->entities as $entity) {
            foreach ($this->defaultProperties as $property => &$value) {
                $entity->{$property} =& $value;
            }
        }
    }

Usage Example

Example #1
0
File: Farm.php Project: scalr/scalr
 /**
  * Reset farm id on clone
  */
 public function __clone()
 {
     if (empty($this->_settings)) {
         $this->settings->load();
     }
     $unref = null;
     $this->id =& $unref;
     $this->_settings = clone $this->_settings;
     $this->_settings->setCriteria([['farmId' => &$this->id]]);
     $this->_settings->setDefaultProperties(['farmId' => &$this->id]);
 }
All Usage Examples Of Scalr\Model\Collections\SettingsCollection::setDefaultProperties