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;
}
}
}
/** * 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]); }