function insert() { DbObject::insert(); if ($children = $this->getChildren()) { foreach ($children as $child) { $child->set('parent_id', $this->id()); } } }
public function insert($force_validation = true) { if (empty($this->bend_workperiod_id)) { $wp = $this->Bend->getWorkPeriodForDate($this->d2Time($this->d_date)); if (!empty($wp)) { $this->bend_workperiod_id = $wp->id; } } parent::insert($force_validation); }
/** * Purpose: Add a user into the password list * @param string $username The username to add * @param string $password The password associated with the username * @return boolean TRUE if the user was successfully added, * FALSE otherwise */ public function addUser($username, $password, $email, $qst1, $qst1Answer, $qst2, $qst2Answer) { // Open a database connection $db = new DbObject(); // Create the array to use with the insert method $memberRecord["username"] = $username; $memberRecord["email"] = $email; $memberRecord["password"] = password_hash($password, PASSWORD_DEFAULT); $qst1Record["question"] = $qst1; $qst1Record["answer"] = $qst1Answer; $qst1Record["username"] = $username; $qst2Record["question"] = $qst2; $qst2Record["answer"] = $qst2Answer; $qst2Record["username"] = $username; // Insert the user into the Password database $memberNumRows = $db->insert($memberRecord, "Member"); $qst1NumRows = $db->insert($qst1Record, "ChallengeQuestion"); $qst2NumRows = $db->insert($qst2Record, "ChallengeQuestion"); return $memberNumRows == 1 && $qst1NumRows == 1 && $qst2NumRows == 1; }
function insert($force_validation = false) { // $this->dt_modified = time(); // Get mimetype if (empty($this->mimetype)) { $this->mimetype = $this->w->getMimetype(FILE_ROOT . "/" . $this->fullpath); } // $this->modifier_user_id = $this->w->Auth->user()->id; <-- why? $this->fullpath = str_replace(FILE_ROOT, "", $this->fullpath); // $this->filename = ($this->filename . getFileExtension($this->mimetype)); $this->is_deleted = 0; parent::insert($force_validation); $this->w->callHook("attachment", "attachment_added_" . $this->parent_table, $this); }
public function insert($force_validation = false) { parent::insert($force_validation); }
function insert($force_validation = false) { $this->digest = sha1($this->message); parent::insert(); }
function saveToItemId($data, $orderIndex, $visitIndex, $productViewIndex, $cartIndex, $days, $keyword) { $dbObject = new DbObject(); foreach ($data->breakdown as $itemId) { if (stripos($itemId->name, "other") === false && stripos($itemId->name, "Unspecified") === false && stripos($itemId->name, "Others") === false) { $id_item_id = md5($itemId->name); $dbObject->insert("item_id", array("id" => $itemId->name)); //foreach($itemId->counts as $metric){ $metrices = $itemId->counts; $itemIdKeyword = array("id" => md5($keyword['id'] . $id_item_id), "id_item_id" => $itemId->name, "id_keyword" => $keyword['id'], "orders" => $metrices[$orderIndex], "visits" => $metrices[$visitIndex], "product_views" => $metrices[$productViewIndex], "carts" => $metrices[$cartIndex]); $score = Formula::getScore($keyword, $itemIdKeyword); if ($score === false) { continue; } $dataarray = array_merge($itemIdKeyword, array('score' => $score)); $dbObject->insert($days . "_days_item_id_ae", $dataarray); } } }
public function insert($force_validation = true) { parent::insert($force_validation); // Call Hook $this->w->callHook("comment", "comment_added_" . $this->obj_table, $this); }
/** * (non-PHPdoc) * @see DbObject::insert() */ function insert($force_validation = false) { try { $this->startTransaction(); // 1. Call on_before_insert of the TaskGroupType $tg = $this->getTaskGroup(); if (!empty($tg)) { // if no assignee selected for newly created task, use task group default assignee if (empty($this->assignee_id)) { $this->first_assignee_id = $this->assignee_id = $tg->default_assignee_id; } else { $this->first_assignee_id = $this->assignee_id; } $tg_type = $tg->getTaskGroupTypeObject(); // check for and set default status if (empty($this->status)) { $this->status = $tg_type->getDefaultStatus(); } $tg_type->on_before_insert($this); } // 2. Call on_before_update of the Tasktype if ($this->task_type) { $this->getTaskTypeObject()->on_before_insert($this); } // 3. insert task into database $validation_response = parent::insert($force_validation); if ($validation_response !== true) { $this->rollbackTransaction(); $this->w->errorMessage($this, "Task", $validation_response, false, "/tasks/edit"); } // run any post-insert routines // add a comment upon task creation $comm = new TaskComment($this->w); $comm->obj_table = $this->getDbTableName(); $comm->obj_id = $this->id; $comm->comment = "Task Created"; $comm->insert(); // add to context for notifications post listener $this->w->ctx("TaskComment", $comm); $this->w->ctx("TaskEvent", "task_creation"); // 4. Call on_after_insert of TaskType if ($this->task_type) { $this->getTaskTypeObject()->on_after_insert($this); } // 5. Call on_after_update of the TaskGroupType if (!empty($tg_type)) { $tg_type->on_after_insert($this); } $this->commitTransaction(); } catch (Exception $ex) { $this->Log->error("Inserting Task: " . $ex->getMessage()); $this->rollbackTransaction(); } }