本文整理汇总了PHP中Core_Model_Item_Abstract::_insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Core_Model_Item_Abstract::_insert方法的具体用法?PHP Core_Model_Item_Abstract::_insert怎么用?PHP Core_Model_Item_Abstract::_insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core_Model_Item_Abstract
的用法示例。
在下文中一共展示了Core_Model_Item_Abstract::_insert方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _insert
protected function _insert()
{
if (!$this->event_id) {
throw new Exception('Cannot create post without event_id');
}
if (!$this->topic_id) {
throw new Exception('Cannot create post without topic_id');
}
parent::_insert();
}
示例2: _insert
protected function _insert()
{
if (empty($this->topic_id)) {
throw new Forum_Model_Exception('Cannot have a post without a topic');
}
if (empty($this->user_id)) {
throw new Forum_Model_Exception('Cannot have a post without a user');
}
parent::_insert();
}
示例3: _insert
protected function _insert()
{
if (!$this->event_id) {
throw new Exception('Cannot create topic without event_id');
}
/*
$this->getParentEvent()->setFromArray(array(
))->save();
*/
parent::_insert();
}
示例4: _insert
protected function _insert()
{
if ($this->_disableHooks) {
return;
}
if (!$this->group_id) {
throw new Exception('Cannot create post without group_id');
}
if (!$this->topic_id) {
throw new Exception('Cannot create post without topic_id');
}
parent::_insert();
}
示例5: _insert
protected function _insert()
{
if ($this->_disableHooks) {
return;
}
if (!$this->group_id) {
throw new Exception('Cannot create topic without group_id');
}
/*
$this->getParentGroup()->setFromArray(array(
))->save();
*/
parent::_insert();
}
示例6: _insert
protected function _insert()
{
if (empty($this->forum_id)) {
throw new Forum_Model_Exception('Cannot have a topic without a forum');
}
if (empty($this->user_id)) {
throw new Forum_Model_Exception('Cannot have a topic without a user');
}
// Increment parent topic count
$forum = $this->getParent();
$forum->topic_count = new Zend_Db_Expr('topic_count + 1');
$forum->modified_date = date('Y-m-d H:i:s');
$forum->save();
parent::_insert();
}
示例7: _insert
protected function _insert()
{
if (!$this->event_id) {
throw new Exception('Cannot create post without event_id');
}
if (!$this->topic_id) {
throw new Exception('Cannot create post without topic_id');
}
// Update topic
$table = Engine_Api::_()->getDbtable('topics', 'event');
$select = $table->select()->where('topic_id = ?', $this->topic_id)->limit(1);
$topic = $table->fetchRow($select);
$topic->lastpost_id = $this->post_id;
$topic->lastposter_id = $this->user_id;
$topic->modified_date = date('Y-m-d H:i:s');
$topic->post_count++;
$topic->save();
parent::_insert();
}
示例8: _insert
protected function _insert()
{
parent::_insert();
$settings = Engine_Api::_()->getApi('settings', 'core');
// Set defaults, process etc
$this->salt = (string) rand(1000000, 9999999);
$this->password = md5($settings->getSetting('core.secret', 'staticSalt') . $this->password . $this->salt);
$this->level_id = Engine_Api::_()->getItemTable('authorization_level')->getDefaultLevel()->level_id;
if (empty($this->_modifiedFields['timezone'])) {
$this->timezone = $settings->getSetting('tcore.locale.timezone', 'America/Los_Angeles');
}
if (empty($this->_modifiedFields['locale'])) {
$this->locale = $settings->getSetting('core.locale.locale', 'auto');
}
if (empty($this->_modifiedFields['language'])) {
$this->language = $settings->getSetting('core.locale.language', 'en_US');
}
$this->enabled = (int) ($settings->getSetting('user.signup.approve', 1) == 1);
$this->verified = (int) ($settings->getSetting('user.signup.verifyemail', 1) < 2);
// $this->invites_used = 0;
$this->search = true;
$this->creation_ip = ip2long($_SERVER['REMOTE_ADDR']);
//$this->verify_code = md5($this->salt).uniqid(mt_rand(), true);
}
示例9: _insert
protected function _insert()
{
$settings = Engine_Api::_()->getApi('settings', 'core');
// These need to be done first so the hook can see them
$this->level_id = Engine_Api::_()->getItemTable('authorization_level')->getDefaultLevel()->level_id;
$this->approved = (int) ($settings->getSetting('user.signup.approve', 1) == 1);
$this->verified = (int) ($settings->getSetting('user.signup.verifyemail', 1) < 2);
$this->enabled = $this->approved && $this->verified;
$this->search = true;
if (empty($this->_modifiedFields['timezone'])) {
$this->timezone = $settings->getSetting('core.locale.timezone', 'America/Los_Angeles');
}
if (empty($this->_modifiedFields['locale'])) {
$this->locale = $settings->getSetting('core.locale.locale', 'auto');
}
if (empty($this->_modifiedFields['language'])) {
$this->language = $settings->getSetting('core.locale.language', 'en_US');
}
if ('cli' !== PHP_SAPI) {
// No CLI
// Get ip address
$db = $this->getTable()->getAdapter();
$ipObj = new Engine_IP();
$ipExpr = new Zend_Db_Expr($db->quoteInto('UNHEX(?)', bin2hex($ipObj->toBinary())));
$this->creation_ip = $ipExpr;
}
// Set defaults, process etc
$this->salt = (string) rand(1000000, 9999999);
if (!empty($this->password)) {
$this->password = md5($settings->getSetting('core.secret', 'staticSalt') . $this->password . $this->salt);
} else {
$this->password = '';
}
// The hook will be called here
parent::_insert();
}
示例10: _insert
protected function _insert()
{
if (null === $this->search) {
$this->search = 1;
}
parent::_insert();
}
示例11: _insert
protected function _insert()
{
$collection = $this->getCollection();
if ($collection && isset($collection->collectible_count)) {
$collection->collectible_count++;
$collection->save();
}
parent::_insert();
}
示例12: _insert
protected function _insert()
{
parent::_insert();
}