本文整理汇总了PHP中ActiveRecordModel::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecordModel::insert方法的具体用法?PHP ActiveRecordModel::insert怎么用?PHP ActiveRecordModel::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecordModel
的用法示例。
在下文中一共展示了ActiveRecordModel::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
protected function insert()
{
$this->product->get()->updateCategoryCounters($this->product->get()->getCountUpdateFilter(), $this->category->get());
$this->product->get()->registerAdditionalCategory($this->category->get());
$insertResult = parent::insert();
Category::updateCategoryIntervals($this->product->get());
return $insertResult;
}
示例2: insert
protected function insert()
{
$str = '';
for ($k = 0; $k < 20; $k++) {
$str .= chr(rand(0, 255));
}
$this->confirmationCode->set(substr(md5($str), 0, 12));
return parent::insert();
}
示例3: insert
protected function insert()
{
$f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('SearchLog', 'keywords'), $this->keywords->get()));
$f->mergeCondition(new EqualsCond(new ARFieldHandle('SearchLog', 'ip'), $this->ip->get()));
if (!ActiveRecordModel::getRecordCount(__CLASS__, $f)) {
parent::insert();
$update = new ARUpdateFilter();
$update->addModifier('time', new ARExpressionHandle('NOW()'));
$update->setCondition(new EqualsCond(new ARFieldHandle(__CLASS__, 'ID'), $this->getID()));
ActiveRecordModel::updateRecordSet(__CLASS__, $update);
}
}
示例4: insert
protected function insert()
{
self::beginTransaction();
$this->dateCreated->set(new ARSerializableDateTime());
parent::insert();
$summary = ProductRatingSummary::getInstance($this->product->get(), $this->ratingType->get());
$summary->save();
$f = new ARUpdateFilter();
$f->addModifier('ratingSum', new ARExpressionHandle('ratingSum+' . $this->rating->get()));
$f->addModifier('ratingCount', new ARExpressionHandle('ratingCount+1'));
$f->addModifier('rating', new ARExpressionHandle('ratingSum/ratingCount'));
$this->updateRatings($f);
self::commit();
}
示例5: insert
protected function insert()
{
$res = parent::insert();
if ($subscriber = NewsletterSubscriber::getInstanceByEmail($this->email->get())) {
$subscriber->user->set($this);
} else {
$subscriber = NewsletterSubscriber::getNewInstanceByUser($this);
$subscriber->isEnabled->set(false);
$subscriber->save();
}
$subscriber->confirmationCode->set('');
$subscriber->save();
return $res;
}
示例6: insert
protected function insert()
{
parent::insert();
$this->parent->save();
}
示例7: insert
protected function insert()
{
if (self::TYPE_CAPTURE == $this->type->get() || self::TYPE_SALE == $this->type->get()) {
$this->order->get()->addCapturedAmount($this->amount->get());
} else {
if (self::TYPE_VOID == $this->type->get()) {
$parentType = $this->parentTransaction->get()->type->get();
if (self::TYPE_CAPTURE == $parentType || self::TYPE_SALE == $parentType) {
$this->order->get()->addCapturedAmount(-1 * $this->parentTransaction->get()->amount->get());
}
}
}
$this->order->get()->save();
if ($this->handler instanceof CreditCardPayment) {
$this->setAsCreditCard();
$this->ccExpiryMonth->set($this->handler->getExpirationMonth());
$this->ccExpiryYear->set($this->handler->getExpirationYear());
$this->ccType->set($this->handler->getCardType());
$this->ccName->set($this->handler->getDetails()->getName());
$this->ccLastDigits->set($this->handler->getCardNumber());
// only the last 5 digits of credit card number are normally stored
if (!$this->handler->isCardNumberStored()) {
$this->truncateCcNumber();
} else {
$this->ccCVV->set(self::encrypt($this->handler->getCardCode()));
}
$this->ccLastDigits->set(self::encrypt($this->ccLastDigits->get()));
}
if ($this->handler) {
$this->method->set(get_class($this->handler));
}
return parent::insert();
}
示例8: insert
protected function insert()
{
$this->deleteInstancesByOrder($this->order->get());
return parent::insert();
}
示例9: insert
protected function insert()
{
parent::insert();
$this->updateConditionRecordCount();
}
示例10: insert
protected function insert()
{
$this->setLastPosition('category');
return parent::insert();
}
示例11: insert
protected function insert()
{
$this->updateProductCounter();
$this->dateCreated->set(new ARSerializableDateTime());
return parent::insert();
}
示例12: insert
protected function insert()
{
$this->setLastPosition();
parent::insert();
}
示例13: insert
protected function insert()
{
if (!$this->shipment->get()->isExistingRecord()) {
return false;
}
return parent::insert();
}
示例14: insert
protected function insert()
{
// the shipment objects are often restored from serialized state, so we must mark all fields as modified
foreach ($this->data as $field) {
if (!$field->isNull()) {
$field->setAsModified();
}
}
// Save updated order status
if ($this->order->get()->isFinalized->get()) {
$this->order->get()->save();
}
if (!$this->status->get()) {
$this->status->set(self::STATUS_NEW);
}
return parent::insert();
}
示例15: insert
protected function insert()
{
$this->updatePriceDiff();
return parent::insert();
}