本文整理汇总了PHP中Zend_Db_Table_Abstract::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table_Abstract::insert方法的具体用法?PHP Zend_Db_Table_Abstract::insert怎么用?PHP Zend_Db_Table_Abstract::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Table_Abstract
的用法示例。
在下文中一共展示了Zend_Db_Table_Abstract::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($id, $state, $info)
{
$data = array('state' => $state, 'info' => $info, 'lastupdate' => time());
$found = $this->find($id);
if ($found) {
$data = array_merge($found, $data);
unset($data['id']);
$this->dbTable->update($data, array('id = ?' => $id));
} else {
$data['id'] = $id;
$data['sticked'] = 0;
$this->dbTable->insert($data);
}
}
示例2: insert
/**
* Insert
*
* Calculates a unique ID and commits the new data
*
* @param array $data
* @return string
*/
public function insert(array $data)
{
$adapter = $this->getAdapter();
$adapter->beginTransaction();
do {
$uniqId = uniqid();
$select = $adapter->select()->from($this->_name, 'COUNT(*)')->where('id = ?', $uniqId);
$found = $adapter->fetchOne($select);
} while ($found > 0);
$data['id'] = $uniqId;
$data['created'] = date('Y-m-d H:i:s');
$created = strtotime($data['created']);
if (array_key_exists('expires', $data) && (is_int($data['expires']) || $data['expires'] == intval($data['expires']))) {
$expires = $data['expires'];
if (0 < $expires && $expires < $created) {
$data['expires'] = date('Y-m-d H:i:s', $created + $expires);
}
} elseif (array_key_exists('expires', $data) && is_string($data['expires'])) {
$expires = strtotime($data['expires']);
if (0 < $expires && $expires < $created) {
unset($data['expires']);
}
} elseif (array_key_exists('expires', $data)) {
unset($data['expires']);
}
parent::insert($data);
$adapter->commit();
return $uniqId;
}
示例3: insert
public function insert(array $data)
{
if (empty($data['created_at'])) {
$data['created_at'] = new Zend_Db_Expr('NOW()');
}
return parent::insert($data);
}
示例4: insert
public function insert($feedbackdata)
{
$data['name'] = $feedbackdata['name'];
$data['email'] = $feedbackdata['email'];
$data['message'] = $feedbackdata['message'];
return parent::insert($data);
}
示例5: insert
/**
* Make sure the created timestamp is always set
*
* @param array &$data
* @return integer
*/
public function insert(&$data)
{
if (!isset($data['created'])) {
$data['created'] = time();
}
return parent::insert($data);
}
示例6: insert
public function insert(array $data)
{
$data['dateins'] = date('Y-m-d H:i:s');
$data['dateco'] = date('Y-m-d H:i:s');
$data['IP'] = $_SERVER["REMOTE_ADDR"];
return parent::insert($data);
}
示例7: saveSupportRequest
public function saveSupportRequest($data)
{
$input['name'] = $data['support_name'];
$input['email'] = $data['support_email'];
$input['query'] = $data['support_query'];
return parent::insert($input);
}
示例8: insert
public function insert(array $data)
{
$date = new Zend_Date();
$data['datebug'] = $date->toString('Y-MM-d');
$data['statut'] = "Non lu";
return parent::insert($data);
}
示例9: insert
public function insert(array $data)
{
require_once 'models/Session.php';
$data['timestamp_created'] = new Zend_Db_Expr('NOW()');
$data['created_by'] = Session::getCurrentUserId();
//don't set is_deleted
return Zend_Db_Table_Abstract::insert($data);
}
示例10: insert
public function insert(array $data)
{
if (empty($data['guid'])) {
$guidMan = new Pandamp_Core_Guid();
$data['guid'] = $guidMan->generateGuid();
}
return parent::insert($data);
}
示例11: insert
/**
* Add user_id to insert query.
*/
public function insert(array $params)
{
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$params['user_id'] = $identity->id;
$params['created'] = new Zend_Db_Expr('NOW()');
return parent::insert($params);
}
示例12: insert
public function insert(array $data)
{
$data['date_s'] = date('Y-m-d H:i:s');
$data['vu'] = 0;
$data['visible'] = 1;
$data['IP'] = $_SERVER["REMOTE_ADDR"];
return parent::insert($data);
}
示例13: insert
public function insert($data)
{
$extra = $this->_getExtraValues($data);
$string = $this->_encodeExtraValues($extra);
$data = $this->_getMainValues($data);
$data[self::TABLE_COLUMN_NAME_EXTRAVALUES] = $string;
return parent::insert($data);
}
示例14: _insert
/**
* insert row into DB
*
* @param array $data ''
* @return void
* @throws Zend_Exception if row cannot be inserted
*/
private function _insert($data)
{
try {
$this->obj->insert($data);
} catch (\Zend_Exception $e) {
throw $e;
}
}
示例15: insert
/**
* Вставляет новую строку в таблицу.
* Все значения '' (пустая строка) в массиве $data заменяются на null.
*
* @param array $data Массив пар "поле => значение".
* @return mixed Значение первичного ключа вставленной строки.
*/
public function insert(array $data)
{
if ($keys = array_keys($data, '')) {
foreach ($keys as $key) {
$data[$key] = null;
}
}
return parent::insert($data);
}