[Raiv-dev] Implementation of our understandin

jorgeeri at onid.orst.edu jorgeeri at onid.orst.edu
Sat May 26 13:56:58 PDT 2007


This seems rather.... large...  How does it look?
//from create_person in the person module
Module::do_action('create_person', $values, $id, $person_mod_id);

 public function create_email($values,$id,$par_id)
    {
        //insert into email table
        $email = DB_DataObject::factory('crm_email');
        $email->email=$values['primary_email'];
        $idVal = $email->insert();
        //get entry where parent id == $par_id and the name is email
        $mod = DB_DataObject::factory('module');
        $mod->package=$par_id;
        $mod->name = 'email';
        $mod->find();
        $mod->fetch();
        $mod_id = $mod->id;//the id we can use to find our field in the type
table
        $type-> DB_DataObject::factory('raiv_types');
        $type->mod_id=$mod_id;
        $type->type='email';
        $type->find();
        $type->fetch();
        $map_id=$type->id;
        $map = DB_DataObject::factory('raiv_map');
        $map->par_id=$id;
        $map->obj_id=$idVal;
        $map->typ_id=$map_id;
        $map->insert();


It feels somehow wrong to us, but we're not sure how else to go about insert.

Thanks
-Eric and Jordan


More information about the Raiv-dev mailing list