id==''){ $contactperson->scope="contact_person"; $contactperson->uid=""; }else{ $contactperson->uid = empty($contactperson->uid) ? $contactperson->id: $contactperson->uid; foreach (Contact::loadAll(array('scope'=>'contact_person','uid'=>$contactperson->id)) as $key => $contact) { $contacts[]= array( 'type'=>$contact->type, 'value'=>$contact->value, ); } } ?>