Exemplo n.º 1
0
 public function createAssociation($script)
 {
     //Create association with this object
     $m = new Default_Model_ContextScriptAssoc();
     $m->contextID = $this->entry->id;
     $m->contextscriptID = $script->id;
     if ($this->user) {
         $m->addedbyID = $this->user->id;
     }
     $m->save();
     return $m;
 }
 public function save(Default_Model_ContextScriptAssoc $value)
 {
     global $application;
     $data = array();
     if (!isnull($value->getId())) {
         $data['id'] = $value->getId();
     }
     if (!isnull($value->getContextID())) {
         $data['contextid'] = $value->getContextID();
     }
     if (!isnull($value->getContextscriptID())) {
         $data['scriptid'] = $value->getContextscriptID();
     }
     if (!isnull($value->getAddedbyID())) {
         $data['addedby'] = $value->getAddedbyID();
     }
     if (!isnull($value->getAddedon())) {
         $data['addedon'] = $value->getAddedon();
     }
     $q1 = 'id = ?';
     $q2 = $value->id;
     if (null === ($id = $value->id)) {
         unset($data['id']);
         $value->id = $this->getDbTable()->insert($data);
     } else {
         $s = $this->getDbTable()->getAdapter()->quoteInto($q1, $q2);
         $this->getDbTable()->update($data, $s);
     }
 }