本文整理汇总了PHP中DataObject::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObject::insert方法的具体用法?PHP DataObject::insert怎么用?PHP DataObject::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObject
的用法示例。
在下文中一共展示了DataObject::insert方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Overrides the save method.
* Delete and replace the list of recipients for email notification of the
* current form.
*
* @param int $id Id of the form.
* @param array $data Array with various data to be processed.
* @param int $langId Language Id. Set by default. Only used to be
* compliant with overrided method.
*
* @return int $saved Id of the form referencing the notification emails.
*/
public function save($id, $data, $langId)
{
$notificationData = array();
$tmp = $data['FN_Email'];
// Start to delete data. It will be replaced.
$this->delete($id);
// set the position of the last separator
$lastSeparatorPos = strrpos($data['FN_Email'], ";");
// set the string length
$stringlength = strlen($data['FN_Email']);
// Test if the value ends with a separator in order to avoid empty value
if ($lastSeparatorPos == $stringlength - 1) {
$tmp = substr_replace($data['FN_Email'], "", $lastSeparatorPos);
}
// set the email list to be inserted
$emailList = explode(';', trim($tmp));
$notificationData['FN_FormID'] = $id;
$notificationData['FN_Type'] = 1;
// replace data
foreach ($emailList as $email) {
$notificationData['FN_Email'] = trim($email);
$saved = parent::insert($notificationData, 1);
}
return $saved;
}
示例2: manageData
public function manageData($id, $data)
{
$where = $this->_db->quoteInto($this->_foreignKey . '= ?', $id);
$this->_db->delete($this->_oDataTableName, $where);
$years = explode(',', $data);
foreach ($years as $value) {
$tmp = array($this->_foreignKey => $id, 'YP_Year' => $value);
parent::insert($tmp, 1);
}
}
示例3: save
public function save($id, $data, $langId)
{
$addrId = $id;
if (empty($id)) {
$addrId = parent::insert($data, $langId);
} else {
parent::save($id, $data, $langId);
}
return $addrId;
}
示例4: insert
public function insert($data, $langId)
{
$oProfile = new GenericProfilesObject();
if (!empty($data[$this->_formDataName])) {
$oAddress = new AddressObject();
$parentAddrId = $oAddress->insert($data[$this->_formDataName], $langId);
unset($data[$this->_formDataName]);
}
$data[$this->_addressField] = $parentAddrId;
$pId = $oProfile->insert($data, $langId);
$data['PP_GenericProfileId'] = $pId;
$id = parent::insert($data, $langId);
return $id;
}
示例5: insert
public function insert($data, $langId)
{
$id = parent::insert($data, $langId);
if (is_array($data['DateRange'])) {
$dateRangeObject = new EventsDateRange();
$dateRangeObject->delete($this->_db->quoteInto('EDR_EventsDataID = ?', $id));
foreach ($data['DateRange'] as $_range) {
if (!empty($_range['from'])) {
$_range['to'] = !empty($_range['to']) ? $_range['to'] : $_range['from'];
$dateRangeObject->insert(array('EDR_EventsDataID' => $id, 'EDR_StartDate' => $_range['from'], 'EDR_EndDate' => $_range['to']));
}
}
}
return $id;
}
示例6: insert
public function insert($data, $langId)
{
// $oProfile = new GenericProfilesObject();
// if (!empty($data['parentForm']))
// {
// $oAddress = new AddressObject();
// $parentAddrId = $oAddress->insert($data['parentForm'], $langId);
// unset($data['parentForm']);
// }
// $data['PP_AddressId'] = $parentAddrId;
//
// $pId = $oProfile->insert($data, $langId);
// $data['PP_GenericProfileId'] = $pId;
$id = parent::insert($data, $langId);
return $id;
}
示例7: checkForSubmit
/**
* Check for submit, therefore all fields must be set
*/
protected function checkForSubmit()
{
if (!$this->wasSubmitted) {
return;
}
$this->validateAllFieldsets();
$Failures = FormularField::getValidationFailures();
if (empty($Failures)) {
$this->dataObject->setFromArray($_POST);
if ($this->submitMode == self::$SUBMIT_MODE_CREATE) {
$this->dataObject->insert();
} elseif ($this->submitMode == self::$SUBMIT_MODE_EDIT) {
$this->dataObject->update();
}
}
foreach ($Failures as $message) {
$this->addFailure($message);
}
if (!$this->submitSucceeded() || $this->submitMode == self::$SUBMIT_MODE_EDIT) {
$this->initFieldsets();
}
}
示例8: insert
public function insert($data, $langId)
{
$id = parent::insert($data, $langId);
return $id;
}
示例9: insert
public function insert($data, $langId)
{
$data['RE_DateCrea'] = date('Y-m-d H-i-s', time());
parent::insert($data, $langId);
}