I have two models, PatientList and CodeList. Several fields in PatientList map to CodeList and those fields can sometimes be null. From PatientList initialize():
 public function initialize(){
    parent::initialize();
    $this->hasOne("study_status","dbsr\Models\CodeList","id",array("alias"=>"StudyStatusChild"));
    $this->hasOne("followup_status","dbsr\Models\CodeList","id",array("alias"=>"FollowupStatusChild"));
  }Then inside the volt I have:
        <td>{% if patient.getStudyStatus() == '' %}   {% else %} {{ patient.getStudyStatusChild().getValue('codelist_value')}}{% endif%}</td>
        <td>{% if patient.getFollowupStatus() == ''  %}   {% else %}  {{ patient.getFollowupStatusChild().getValue('codelist_value')}} {%endif%}</td>In cases where getFollowupStatus() or getStudyStatus() are blank, the code inside the {% else %} appears to still be evaluated, and the object is null so it throws an error. How can I display the contents of child records in the case that they are sometimes blank?