protected function setElementDefaultOptions_Element_OphCiExamination_OverallManagementPlan(models\Element_OphCiExamination_OverallManagementPlan $element, $action) { if ($action == 'create') { if ($previous_om = models\Element_OphCiExamination_OverallManagementPlan::model()->with(array('event' => array('condition' => 'event.deleted = 0', 'with' => array('episode' => array('condition' => 'episode.deleted = 0 and episode.id = ' . $this->episode->id)))))->find()) { foreach ($previous_om->attributes as $key => $value) { if (!in_array($key, array('id', 'created_date', 'created_user_id', 'last_modified_date', 'last_modified_user_id'))) { $element->{$key} = $value; } } } } }