本文整理汇总了PHP中X2Model::beforeDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP X2Model::beforeDelete方法的具体用法?PHP X2Model::beforeDelete怎么用?PHP X2Model::beforeDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X2Model
的用法示例。
在下文中一共展示了X2Model::beforeDelete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeDelete
public function beforeDelete()
{
return parent::beforeDelete();
}
示例2: beforeDelete
/**
* Clear out records associated with this quote before deletion.
*/
public function beforeDelete()
{
QuoteProduct::model()->deleteAllByAttributes(array('quoteId' => $this->id));
// for old relationships generated with incorrect type name
Relationships::model()->deleteAllByAttributes(array('firstType' => 'quotes', 'firstId' => $this->id));
// generate action record for history
$contact = $this->contact;
if (!empty($contact)) {
$action = new Actions();
$action->associationType = 'contacts';
$action->type = 'quotesDeleted';
$action->associationId = $contact->id;
$action->associationName = $contact->name;
$action->assignedTo = Yii::app()->getSuModel()->username;
$action->completedBy = Yii::app()->getSuModel()->username;
$action->createDate = time();
$action->dueDate = time();
$action->completeDate = time();
$action->visibility = 1;
$action->complete = 'Yes';
$action->actionDescription = "Deleted Quote: <span style=\"font-weight:bold;\">{$this->id}</span> {$this->name}";
// Save after deletion of the model so that this action itself doensn't get deleted
$action->save();
}
return parent::beforeDelete();
}