本文整理汇总了PHP中Type::setAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::setAttributes方法的具体用法?PHP Type::setAttributes怎么用?PHP Type::setAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type::setAttributes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAttributes
/**
* Sets attributes from SQL result row to object.
*
* @param array $row data from DB
*
* @return void
*/
protected function setAttributes(array $row)
{
parent::setAttributes($row);
if (isset($row['blueprintTypeID'])) {
$this->producedFromBlueprintId = (int) $row['blueprintTypeID'];
}
}
示例2: actionCreate
/**
*
*/
public function actionCreate()
{
$model = new Type();
if (($data = Yii::app()->getRequest()->getPost('Type')) !== null) {
$model->setAttributes($data);
if ($model->save() && $model->storeTypeAttributes(Yii::app()->getRequest()->getPost('attributes', []))) {
Yii::app()->getUser()->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('StoreModule.store', 'Product type is created'));
$this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['create']));
}
}
$this->render('create', ['model' => $model, 'availableAttributes' => Attribute::model()->findAll()]);
}
示例3: actionCreate
public function actionCreate()
{
$model = new Type();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (($data = Yii::app()->getRequest()->getPost('Type')) !== null) {
$model->setAttributes($data);
$model->categories = serialize(Yii::app()->getRequest()->getPost('categories'));
if ($model->save()) {
$model->setTypeAttributes(Yii::app()->getRequest()->getPost('attributes'));
Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('StoreModule.type', 'Тип товара создан.'));
$this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['create']));
}
}
//$criteria = new CDbCriteria();
//$criteria->addNotInCondition('id', CHtml::listData($model->attributeRelation, 'attribute_id', 'attribute_id'));
$availableAttributes = Attribute::model()->findAll();
$this->render('create', ['model' => $model, 'availableAttributes' => $availableAttributes]);
}
示例4: setAttributes
/**
* Sets attributes from SQL result row to object.
*
* @param array $row data from DB
*
* @return void
*/
protected function setAttributes(array $row)
{
parent::setAttributes($row);
$this->productId = (int) $row['productTypeID'];
$this->maxProductionLimit = (int) $row['maxProductionLimit'];
}
示例5: setAttributes
/**
* Sets attributes from SQL result row to object. Overwrites inherited method.
*
* @param array $row data from DB
*
* @return void
*/
protected function setAttributes(array $row)
{
//call parent method
parent::setAttributes($row);
if (isset($row['marketGroupID'])) {
$this->marketGroupID = (int) $row['marketGroupID'];
}
}
示例6: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$model = new Type('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Type'])) {
$model->setAttributes($_GET['Type']);
}
$this->render('admin', array('model' => $model));
}
示例7: actionIndex
/**
* Управление Типами форм обучения.
*
* @return void
*/
public function actionIndex()
{
$roles = ['1'];
$role = \Yii::app()->user->role;
if (array_intersect($role, $roles)) {
$model = new Type('search');
$model->unsetAttributes();
// clear any default values
if (Yii::app()->getRequest()->getParam('Type') !== null) {
$model->setAttributes(Yii::app()->getRequest()->getParam('Type'));
}
$this->render('index', ['model' => $model]);
} else {
throw new CHttpException(403, 'Ошибка прав доступа.');
}
}