本文整理汇总了PHP中CActiveRecord::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveRecord::delete方法的具体用法?PHP CActiveRecord::delete怎么用?PHP CActiveRecord::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActiveRecord
的用法示例。
在下文中一共展示了CActiveRecord::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($hard = false)
{
if ($hard === true) {
return parent::delete();
}
return $this->saveAttributes(['updated_at' => time(), 'status' => self::STATUS_DELETED]);
}
示例2: delete
public function delete()
{
if ($this->wlabel_id != Yii::app()->user->getWhiteLabelId()) {
return false;
}
return parent::delete();
}
示例3: delete
public function delete()
{
if (!$this->_hasStatus()) {
return parent::delete();
}
$this->status = self::STATUS_DELETED;
return $this->save(false);
}
示例4: delete
public function delete()
{
$status = parent::delete();
$inversed = Contact::model()->findByAttributes(array('user_id' => $this->contact_id, 'contact_id' => $this->user_id));
if ($inversed !== null) {
$inversed->delete();
}
return $status;
}
示例5: delete
public function delete()
{
foreach ($this->Transactions as $transaction) {
$transaction->intCorrelation = 0;
$transaction->intType = 0;
$transaction->save();
}
return parent::delete();
}
示例6: delete
public function delete($hard = false)
{
// Do a soft delete if the hard delete is not forced.
if (!$hard && $this->hasAttribute('deleted')) {
$this->deleted = 1;
return $this->save(false);
}
parent::delete();
}
示例7: delete
public function delete()
{
$users = User::model()->findAll();
foreach ($users as $user) {
$IncomeMap = UserIncomeMap::model()->findByPk(array('user_id' => $user->id, 'itemVatCat_id' => $this->id));
if ($IncomeMap) {
//'user_id', 'itemVatCat_id'
$IncomeMap->delete();
}
}
parent::delete();
}
示例8: delete
public function delete()
{
foreach ($this->Transactions as $transaction) {
$transaction->extCorrelation = 0;
$transaction->save();
}
foreach ($this->Bankbooks as $bankbook) {
$bankbook->extCorrelation = 0;
$bankbook->save();
}
return parent::delete();
}
示例9: delete
/**
* Update standart delete action
*/
public function delete()
{
$columns = $this->tableSchema->columns;
if (array_key_exists('active', $columns)) {
if ($this->beforeDelete()) {
$this->active = 0;
$res = $this->save(false);
$this->afterDelete();
return $res;
}
}
return parent::delete();
}
示例10: delete
public function delete()
{
parent::delete();
$this->dbConnection->createCommand("DELETE FROM ReportUserLastUsedParams WHERE reportId={$this->id}")->execute();
$this->dbConnection->createCommand("DELETE FROM ReportParameters WHERE reportId={$this->id}")->execute();
$this->dbConnection->createCommand("DELETE FROM ReportRows WHERE reportId={$this->id}")->execute();
$groups = $this->groups;
if (isset($groups) && count($groups) > 0) {
foreach ($groups as $group) {
$group->delete();
}
}
}
示例11: delete
public function delete()
{
/**
* delete related records
*/
foreach ($this->relations() as $relName => $relation) {
if ($relation[0] != self::HAS_MANY && $relation[0] != self::HAS_ONE) {
continue;
}
foreach ($this->{$relName} as $relRecord) {
$relRecord->delete();
}
}
return parent::delete();
}
示例12: processModel
/**
* Recursive function that deletes all children models to the $model.
*
* @param CActiveRecord $model the model to process.
* @param boolean $delete whether to delete the $model (the top model's deletion is handled by beforeDelete).
*/
protected function processModel($model, $delete = true)
{
foreach ($model->relations() as $relationName => $relation) {
$type = $relation[0];
$className = $relation[1];
$foreignKey = $relation[2];
if ($type == CActiveRecord::HAS_MANY) {
foreach ($model->{$relationName} as $subModel) {
if (!empty($subModel)) {
$this->processModel($subModel);
}
}
} elseif ($type == CActiveRecord::HAS_ONE) {
if (!empty($model->{$relationName})) {
$this->processModel($model->{$relationName});
}
}
}
if ($delete) {
$model->delete();
}
}
示例13: delete
/**
* besides deleting record
* deletes its core entity as well
*
* @return bool|void
*/
public function delete()
{
$id = $this->lb_record_primary_key;
$coreEntity = $this->getCoreEntity();
$result = parent::delete();
if ($result) {
$coreEntity->delete();
}
return $result;
}
示例14: delete
public function delete()
{
$this->removeFile($this->galleryDir . '/' . $this->getFileName('') . '.' . $this->galleryExt);
//create image preview for gallery manager
$this->removeFile($this->galleryDir . '/_' . $this->getFileName('') . '.' . $this->galleryExt);
foreach ($this->gallery->versions as $version => $actions) {
$this->removeFile($this->galleryDir . '/' . $this->getFileName($version) . '.' . $this->galleryExt);
}
return parent::delete();
}
示例15: delete
public function delete()
{
$this->removeFile(Yii::getPathOfAlias('webroot') . '/' . $this->galleryDir . '/' . $this->getFileName('') . '.' . $this->galleryExt);
$this->removeFile(Yii::getPathOfAlias('webroot') . '/' . $this->galleryDir . '/_' . $this->getFileName('') . '.' . $this->galleryExt);
$this->removeImages();
return parent::delete();
}