public function refresh()
{
/* @var $record BaseActiveRecord */
$record = static::findOne($this->getPrimaryKey(true));
if ($record === null) {
return false;
}
foreach ($this->attributes() as $name) {
$this->_attributes[$name] = isset($record->_attributes[$name]) ? $record->_attributes[$name] : null;
}
$this->_oldAttributes = $record->_oldAttributes;
$this->_related = [];
$this->afterRefresh();
return true;
}