本文整理汇总了PHP中Core_Model_Item_Abstract::_postInsert方法的典型用法代码示例。如果您正苦于以下问题:PHP Core_Model_Item_Abstract::_postInsert方法的具体用法?PHP Core_Model_Item_Abstract::_postInsert怎么用?PHP Core_Model_Item_Abstract::_postInsert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core_Model_Item_Abstract
的用法示例。
在下文中一共展示了Core_Model_Item_Abstract::_postInsert方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _postInsert
protected function _postInsert()
{
// Increment user post count
$table = Engine_Api::_()->getItemTable('forum_signature');
$select = $table->select()->where('user_id = ?', $this->user_id)->limit(1);
// Update user post count
$row = $table->fetchRow($select);
if (null === $row) {
$row = $table->createRow();
$row->user_id = $this->user_id;
$row->post_count = 0;
}
$row->post_count = new Zend_Db_Expr('post_count + 1');
$row->save();
// Update topic post count
$topic = $this->getParent();
$topic->post_count = new Zend_Db_Expr('post_count + 1');
$topic->modified_date = $this->creation_date;
$topic->lastpost_id = $this->post_id;
$topic->lastposter_id = $this->user_id;
$topic->save();
// Update forum post count
$forum = $topic->getParent();
$forum->post_count = new Zend_Db_Expr('post_count + 1');
$forum->modified_date = $this->creation_date;
$forum->lastpost_id = $this->post_id;
$forum->lastposter_id = $this->user_id;
$forum->save();
parent::_postInsert();
}
示例2: _postInsert
public function _postInsert()
{
parent::_postInsert();
// Create auth stuff
$context = Engine_Api::_()->authorization()->context;
$context->setAllowed($this, 'everyone', 'view', true);
$context->setAllowed($this, 'registered', 'comment', true);
$viewer = Engine_Api::_()->user()->getViewer();
}
示例3: _postInsert
protected function _postInsert()
{
if ($this->_disableHooks) {
return;
}
// Update topic
$table = Engine_Api::_()->getDbtable('topics', 'advgroup');
$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::_postInsert();
}
示例4: _postInsert
protected function _postInsert()
{
if ($this->_disableHooks) {
return;
}
parent::_postInsert();
// Create auth stuff
$context = Engine_Api::_()->authorization()->context;
foreach (array('everyone', 'registered', 'member') as $role) {
$context->setAllowed($this, $role, 'view', true);
}
}
示例5: _postInsert
protected function _postInsert()
{
parent::_postInsert();
// Create auth stuff
$context = $this->api()->authorization()->context;
// View
$view_options = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('user', $this, 'auth_view');
if (empty($view_options) || !is_array($view_options)) {
$view_options = array('member', 'network', 'registered', 'everyone');
}
foreach ($view_options as $role) {
$context->setAllowed($this, $role, 'view', true);
}
// Comment
$comment_options = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('user', $this, 'auth_comment');
if (empty($comment_options) || !is_array($comment_options)) {
$comment_options = array('member', 'network', 'registered', 'everyone');
}
foreach ($comment_options as $role) {
$context->setAllowed($this, $role, 'comment', true);
}
}
示例6: _postInsert
protected function _postInsert()
{
// Update product
$product = $this->getProduct();
$product->setFromArray($this->getProductParams());
$product->save();
parent::_postInsert();
}
示例7: _postInsert
protected function _postInsert()
{
$table = Engine_Api::_() -> getDbTable('signatures', 'ynvideo');
$select = $table -> select() -> where('user_id = ?', $this -> owner_id) -> limit(1);
$row = $table -> fetchRow($select);
if (null == $row)
{
$row = $table -> createRow();
$row -> user_id = $this -> owner_id;
$row -> video_count = 1;
}
else
{
$row -> video_count = new Zend_Db_Expr('video_count + 1');
}
$row -> save();
parent::_postInsert();
}
示例8: _postInsert
protected function _postInsert()
{
parent::_postInsert();
// Update sku
$this->_updateSku();
}