本文整理汇总了PHP中yii\db\ActiveRecord::afterDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::afterDelete方法的具体用法?PHP ActiveRecord::afterDelete怎么用?PHP ActiveRecord::afterDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\db\ActiveRecord
的用法示例。
在下文中一共展示了ActiveRecord::afterDelete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterDelete
/**
* Remove images after model deletion
*/
public function afterDelete()
{
// Remove children Photo models
foreach ($this->photos as $photo) {
$photo->delete();
}
// Remove directory
FileHelper::removeDirectory(Yii::getAlias('@webroot/images/' . $this->id));
parent::afterDelete();
}
示例2: afterDelete
public function afterDelete()
{
foreach ($this->books as $book) {
$book->delete();
}
parent::afterDelete();
}
示例3: afterDelete
public function afterDelete()
{
foreach ($this->articleMultArticles as $articleMultArticle) {
$articleMultArticle->delete();
}
parent::afterDelete();
}
示例4: afterDelete
public function afterDelete()
{
parent::afterDelete();
$xs_unicom = new \XS('unicom');
$xs_index = $xs_unicom->index;
$xs_index->del($this->id);
}
示例5: afterDelete
/**
*
*/
public function afterDelete()
{
parent::afterDelete();
$auth = Yii::$app->authManager;
$permission = $auth->getPermission($this->name);
$auth->remove($permission);
}
示例6: afterDelete
/**
* Remove images and users after model deletion
*/
public function afterDelete()
{
foreach ($this->users as $user) {
$user->delete();
}
parent::afterDelete();
}
示例7: afterDelete
public function afterDelete()
{
foreach ($this->getAttachments() as $attach) {
$attach->delete();
}
return parent::afterDelete();
}
示例8: afterDelete
public function afterDelete()
{
parent::afterDelete();
if ($this->preview) {
@unlink(Yii::getAlias('@webroot') . $this->preview);
}
}
示例9: afterDelete
public function afterDelete()
{
parent::afterDelete();
foreach ($this->getShopMedias()->all() as $media) {
$media->delete();
}
}
示例10: afterDelete
public function afterDelete()
{
foreach ($this->relLibraryBooks as $relLibraryBook) {
$relLibraryBook->delete();
}
parent::afterDelete();
}
示例11: afterDelete
/**
* Delete file
*/
public function afterDelete()
{
$root = Yii::getAlias('@webroot');
if (file_exists($root . $this->path)) {
unlink($root . $this->path);
}
parent::afterDelete();
}
示例12: afterDelete
public function afterDelete()
{
parent::afterDelete();
foreach ($this->history as $model) {
$model->delete();
}
return true;
}
示例13: afterDelete
public function afterDelete()
{
$file = Yii::$app->params['uploadSalePath'] . DIRECTORY_SEPARATOR . $this->sale_id . DIRECTORY_SEPARATOR . $this->name;
if (file_exists($file)) {
unlink($file);
}
return parent::afterDelete();
}
示例14: afterDelete
public function afterDelete()
{
WarehouseEmail::deleteAll(['warehouse_id' => $this->id]);
WarehousePhone::deleteAll(['warehouse_id' => $this->id]);
WarehouseOpeninghours::deleteAll(['warehouse_id' => $this->id]);
WarehouseProduct::deleteAll(['warehouse_id' => $this->id]);
return parent::afterDelete();
}
示例15: afterDelete
public function afterDelete()
{
parent::afterDelete();
// Create history record
$sql = "DELETE FROM `{$this->tableName()}` WHERE `ID` = {$this->attributes['ID']};";
$this->db->createCommand()->insert('History', ['User' => Yii::$app->user->identity->username, 'Command' => $sql])->execute();
return true;
}