OEModule\OphCoCvi\components\OphCoCvi_Manager::getElementForEvent PHP Method

getElementForEvent() protected method

protected getElementForEvent ( $event, $element_class ) : CActiveRecord | null
$event
$element_class
return CActiveRecord | null
    protected function getElementForEvent($event, $element_class)
    {
        $core_class = 'Element_OphCoCvi_EventInfo';
        $namespaced_class = '\\OEModule\\OphCoCvi\\models\\' . $core_class;
        $cls_rel_map = array('Element_OphCoCvi_ClinicalInfo' => 'clinical_element', 'Element_OphCoCvi_ClericalInfo' => 'clerical_element', 'Element_OphCoCvi_ConsentSignature' => 'consent_element', 'Element_OphCoCvi_Demographics' => 'demographics_element');
        if (!isset($this->info_el_for_events[$event->id])) {
            $this->info_el_for_events[$event->id] = $namespaced_class::model()->with(array_values($cls_rel_map))->findByAttributes(array('event_id' => $event->id));
        }
        if (array_key_exists($element_class, $cls_rel_map)) {
            return $this->info_el_for_events[$event->id]->{$cls_rel_map[$element_class]};
        } elseif ($element_class == $core_class) {
            return $this->info_el_for_events[$event->id];
        }
    }