<?php
namespace ext_recurring_payments\console\components\behaviors;
// defined('MW_PATH') || exit('No direct script access allowed');
/**
* MwExtBoilerplateAppBehavior TODO @classname change it with extensions name
*
* @package mw-ext-boilerplate extension TODO @package name
* @author Jim Well John Balatero <jim@optidig.biz> TODO @author
* @link http://www.optidig.com/
* @since 1.0
*
* @property owner is the instance of extension obj
*
* To get current extensions's version, you can use:
* $this->owner->version
*/
class AppBehavior extends \CBehavior
{
/**
* Called when app is console
*/
public function run() {
Yii::app()->hooks->addAction('console_command_send_campaigns_after_process', array($this, 'CustomerDueAccountDeactivate'));
}
/*
* This will automatically deactive customer once the Price Plan is Due
*/
public function CustomerDueAccountDeactivate($command)
{
$model = Customer::model()->findByPk(2);
$model->status = 'inactive';
$model->confirm_email = $model->email;
if($model->save()){
// Yii::app()->notify->addSuccess('Price Plan of <b><u>'.ucwords($customer['first_name'].' '.$customer['last_name']).'</u></b> is due. Account automatically deactivated.');
}else{
// Yii::app()->notify->addError('Price Plan of <b><u>'.ucwords($customer['first_name'].' '.$customer['last_name']).'</u></b> is due.Failed to deactivate account, please deactivate manually.');
}
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.