本文整理汇总了PHP中Payment::setAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::setAttributes方法的具体用法?PHP Payment::setAttributes怎么用?PHP Payment::setAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::setAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAdmin
public function actionAdmin()
{
$model = new Payment('search');
$model->unsetAttributes();
if (isset($_GET['Payment'])) {
$model->setAttributes($_GET['Payment']);
}
$this->render('admin', array('model' => $model));
}
示例2: actionView
public function actionView()
{
$model = new Payment('search');
$model->unsetAttributes();
if (Yii::app()->request->isAjaxRequest) {
$params = Yii::app()->request->getParam('Payment');
$model->setAttributes($params);
Yii::app()->user->setState('PaymentFilterState', $params);
$test = '=);';
}
$data = $model->getTotalData();
$data = array('in' => array('sum' => empty($data) ? 0 : $data[0]['s'], 'count' => empty($data) ? 0 : $data[0]['ctn']), 'out' => array('sum' => empty($data) ? 0 : $data[1]['s'], 'count' => empty($data) ? 0 : $data[1]['ctn']));
$this->render('admin', array('model' => $model, 'data' => $data, 'test' => $test));
}
示例3: actionCreate
public function actionCreate()
{
$model = new Payment();
if (Yii::app()->getRequest()->getIsPostRequest() && isset($_POST['Payment'])) {
$model->setAttributes(Yii::app()->getRequest()->getPost('Payment'));
$model->setPaymentSystemSettings(Yii::app()->getRequest()->getPost('PaymentSettings', []));
if ($model->save()) {
Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('PaymentModule.payment', 'Record was created!'));
if (!isset($_POST['submit-type'])) {
$this->redirect(['update', 'id' => $model->id]);
} else {
$this->redirect([$_POST['submit-type']]);
}
}
}
//@TODO вынести в метод модели
$criteria = new CDbCriteria();
$criteria->select = new CDbExpression('MAX(position) as position');
$max = $model->find($criteria);
$model->position = $max->position + 1;
$this->render('create', ['model' => $model]);
}