Commit 0cf3014e by semenov

Начало разработки

parent ab943e30
......@@ -16,6 +16,24 @@ return [
'items' =>
[
[
"label" => "Типы плательщиков",
"url" => ["shop/admin-shop-person-type"],
"img" => ['\skeeks\modules\cms\shop\assets\Asset', 'icons/shop.png']
],
[
"label" => "Платежные системы",
"url" => ["shop/admin-shop-pay-system"],
"img" => ['\skeeks\modules\cms\shop\assets\Asset', 'icons/shop.png']
],
[
"label" => "Службы доставки",
"url" => ["shop/admin-shop-delivery"],
"img" => ['\skeeks\modules\cms\shop\assets\Asset', 'icons/shop.png']
],
[
"label" => "Заказы",
"url" => ["shop/admin-order"],
"img" => ['\skeeks\modules\cms\shop\assets\Asset', 'icons/shop.png']
......
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 02.04.2015
*/
namespace skeeks\modules\cms\shop\controllers;
use skeeks\cms\modules\admin\controllers\AdminModelEditorSmartController;
use skeeks\modules\cms\shop\models\ShopDelivery;
use skeeks\modules\cms\shop\models\ShopPaySystem;
use skeeks\modules\cms\shop\models\ShopPersonType;
/**
* Class AdminShopPaySystemController
* @package skeeks\modules\cms\shop\controllers
*/
class AdminShopDeliveryController extends AdminModelEditorSmartController
{
public function init()
{
$this->_label = "Службы доставки";
$this->_modelShowAttribute = "name";
$this->_modelClassName = ShopDelivery::className();
$this->modelValidate = true;
$this->enableScenarios = true;
parent::init();
}
}
\ No newline at end of file
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 02.04.2015
*/
namespace skeeks\modules\cms\shop\controllers;
use skeeks\cms\modules\admin\controllers\AdminModelEditorSmartController;
use skeeks\modules\cms\shop\models\ShopPaySystem;
use skeeks\modules\cms\shop\models\ShopPersonType;
/**
* Class AdminShopPaySystemController
* @package skeeks\modules\cms\shop\controllers
*/
class AdminShopPaySystemController extends AdminModelEditorSmartController
{
public function init()
{
$this->_label = "Платежные системы";
$this->_modelShowAttribute = "name";
$this->_modelClassName = ShopPaySystem::className();
$this->modelValidate = true;
$this->enableScenarios = true;
parent::init();
}
}
\ No newline at end of file
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 02.04.2015
*/
namespace skeeks\modules\cms\shop\controllers;
use skeeks\cms\modules\admin\controllers\AdminModelEditorSmartController;
use skeeks\modules\cms\shop\models\ShopPersonType;
/**
* Class AdminShopPersonTypeController
* @package skeeks\modules\cms\shop\controllers
*/
class AdminShopPersonTypeController extends AdminModelEditorSmartController
{
public function init()
{
$this->_label = "Типы плательщиков";
$this->_modelShowAttribute = "name";
$this->_modelClassName = ShopPersonType::className();
$this->modelValidate = true;
$this->enableScenarios = true;
parent::init();
}
}
\ No newline at end of file
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 01.04.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150401_100558_create_table__shop_fuser extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%shop_fuser}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%shop_fuser}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%shop_fuser}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%shop_fuser}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%shop_fuser}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%shop_fuser}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%shop_fuser}} COMMENT = 'Пользователи для корзины';");
$this->addForeignKey(
'shop_fuser_created_by', "{{%shop_fuser}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'shop_fuser_updated_by', "{{%shop_fuser}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
$this->dropForeignKey("shop_fuser_updated_by", "{{%shop_fuser}}");
$this->dropForeignKey("shop_fuser_updated_by", "{{%shop_fuser}}");
$this->dropTable("{{%shop_fuser}}");
}
}
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 01.04.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150401_100601_create_table__shop_person_type extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%shop_person_type}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%shop_person_type}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', //статус, активна некативна, удалено
], $tableOptions);
$this->execute("ALTER TABLE {{%shop_person_type}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%shop_person_type}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%shop_person_type}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%shop_person_type}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%shop_person_type}} ADD INDEX(status);");
$this->execute("ALTER TABLE {{%shop_person_type}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%shop_person_type}} COMMENT = 'Типы плательщиков';");
$this->addForeignKey(
'shop_person_type_created_by', "{{%shop_person_type}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'shop_person_type_updated_by', "{{%shop_person_type}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
$this->dropForeignKey("shop_person_type_updated_by", "{{%shop_person_type}}");
$this->dropForeignKey("shop_person_type_updated_by", "{{%shop_person_type}}");
$this->dropTable("{{%shop_person_type}}");
}
}
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 01.04.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150401_100610_create_table__shop_pay_system extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%shop_pay_system}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%shop_pay_system}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'currency' => Schema::TYPE_STRING. '(3) DEFAULT "RUB"',
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
'description' => Schema::TYPE_TEXT . ' NULL',
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
], $tableOptions);
$this->execute("ALTER TABLE {{%shop_pay_system}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%shop_pay_system}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%shop_pay_system}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%shop_pay_system}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%shop_pay_system}} ADD INDEX(currency);");
$this->execute("ALTER TABLE {{%shop_pay_system}} ADD INDEX(status);");
$this->execute("ALTER TABLE {{%shop_pay_system}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%shop_pay_system}} COMMENT = 'Платежные системы';");
$this->addForeignKey(
'shop_pay_system_created_by', "{{%shop_pay_system}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'shop_pay_system_updated_by', "{{%shop_pay_system}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
$this->dropForeignKey("shop_pay_system_updated_by", "{{%shop_pay_system}}");
$this->dropForeignKey("shop_pay_system_updated_by", "{{%shop_pay_system}}");
$this->dropTable("{{%shop_pay_system}}");
}
}
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 01.04.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150401_100620_create_table__shop_delivery extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%shop_delivery}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%shop_delivery}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'currency' => Schema::TYPE_STRING. '(3) NULL DEFAULT "RUB"',
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
'description' => Schema::TYPE_TEXT . ' NULL',
'period_from' => Schema::TYPE_INTEGER . ' NULL',
'period_to' => Schema::TYPE_INTEGER . ' NULL',
'period_type' => Schema::TYPE_STRING . '(1) NULL',
'weight_from' => Schema::TYPE_INTEGER . ' NULL',
'weight_to' => Schema::TYPE_INTEGER . ' NULL',
'order_price_from' => Schema::TYPE_DECIMAL . '(18,2) NULL',
'order_price_to' => Schema::TYPE_DECIMAL . '(18,2) NULL',
'order_currency' => Schema::TYPE_STRING . '(3) NULL',
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
'price' => Schema::TYPE_DECIMAL . '(18,2)',
'currency' => Schema::TYPE_STRING. '(3) DEFAULT "RUB"',
], $tableOptions);
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(currency);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(status);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(period_from);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(period_to);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(weight_from);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(weight_to);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(order_price_from);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(order_price_to);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(order_currency);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(price);");
$this->execute("ALTER TABLE {{%shop_delivery}} ADD INDEX(currency);");
$this->execute("ALTER TABLE {{%shop_delivery}} COMMENT = 'Платежные системы';");
$this->addForeignKey(
'shop_delivery_created_by', "{{%shop_delivery}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'shop_delivery_updated_by', "{{%shop_delivery}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
$this->dropForeignKey("shop_delivery_updated_by", "{{%shop_delivery}}");
$this->dropForeignKey("shop_delivery_updated_by", "{{%shop_delivery}}");
$this->dropTable("{{%shop_delivery}}");
}
}
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 01.04.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150401_110600_create_table__shop_order extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%shop_order}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%shop_order}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'person_type_id' => Schema::TYPE_INTEGER . ' NULL',
'payed' => Schema::TYPE_SMALLINT . '(1) NOT NULL DEFAULT 0',
'payed_at' => Schema::TYPE_INTEGER . ' NULL',
'canceled' => Schema::TYPE_SMALLINT . '(1) NOT NULL DEFAULT 0',
'canceled_at' => Schema::TYPE_INTEGER . ' NULL',
'reason_canceled' => Schema::TYPE_STRING . '(255) NULL',
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
'price' => Schema::TYPE_DECIMAL . '(18,2)',
'currency' => Schema::TYPE_STRING. '(3) DEFAULT "RUB"',
'price_delivery' => Schema::TYPE_DECIMAL . '(18,2) NULL',
'allow_delivery' => Schema::TYPE_SMALLINT . '(1) NOT NULL DEFAULT 0',
'discount_value' => Schema::TYPE_DECIMAL . '(18,2) NULL',
'user_id' => Schema::TYPE_INTEGER . ' NOT NULL',
'pay_system_id' => Schema::TYPE_INTEGER . ' NULL',
'delivery_id' => Schema::TYPE_INTEGER . ' NULL',
'user_description' => Schema::TYPE_STRING . '(255) NULL',
'additional_info' => Schema::TYPE_STRING . '(255) NULL',
'ps_status' => Schema::TYPE_STRING . '(1) NULL',
'ps_status_code' => Schema::TYPE_STRING . '(5) NULL',
'ps_status_description' => Schema::TYPE_STRING . '(255) NULL',
'ps_status_message' => Schema::TYPE_STRING . '(255) NULL',
'ps_sum' => Schema::TYPE_DECIMAL . '(18,2) NULL',
'ps_currency' => Schema::TYPE_STRING. '(3) NULL',
'ps_respose_at' => Schema::TYPE_INTEGER. ' NULL',
'comments' => Schema::TYPE_TEXT. ' NULL',
'tax_value' => Schema::TYPE_DECIMAL . '(18,2) NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(person_type_id);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(payed);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(payed_at);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(status);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(canceled);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(canceled_at);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(reason_canceled);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(price);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(currency);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(price_delivery);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(allow_delivery);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(discount_value);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(user_id);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(pay_system_id);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(delivery_id);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(user_description);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(additional_info);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(ps_status);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(ps_status_code);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(ps_status_description);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(ps_status_message);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(ps_sum);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(ps_currency);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(ps_respose_at);");
$this->execute("ALTER TABLE {{%shop_order}} ADD INDEX(tax_value);");
$this->execute("ALTER TABLE {{%shop_order}} COMMENT = 'Заказы';");
$this->addForeignKey(
'shop_order_created_by', "{{%shop_order}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'shop_order_updated_by', "{{%shop_order}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'shop_order_person_type_id', "{{%shop_order}}",
'person_type_id', '{{%shop_person_type}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'shop_order__user_id', "{{%shop_order}}",
'user_id', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function safeDown()
{
$this->dropForeignKey("shop_order_updated_by", "{{%shop_order}}");
$this->dropForeignKey("shop_order_updated_by", "{{%shop_order}}");
$this->dropForeignKey("shop_order_person_type_id", "{{%shop_order}}");
$this->dropForeignKey("shop_order__user_id", "{{%shop_order}}");
$this->dropTable("{{%shop_order}}");
}
}
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 02.04.2015
*/
namespace skeeks\modules\cms\shop\models;
use skeeks\cms\models\behaviors\HasStatus;
use skeeks\cms\models\behaviors\HasStatusBoolean;
use skeeks\cms\models\Core;
use \Yii;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "{{%shop_delivery}}".
*
* @property integer $id
* @property integer $created_by
* @property integer $updated_by
* @property integer $created_at
* @property integer $updated_at
* @property string $currency
* @property string $name
* @property string $description
* @property integer $period_from
* @property integer $period_to
* @property string $period_type
* @property integer $weight_from
* @property integer $weight_to
* @property string $order_price_from
* @property string $order_price_to
* @property string $order_currency
* @property integer $status
* @property string $price
*
* @property CmsUser $updatedBy
* @property CmsUser $createdBy
*/
class ShopDelivery extends Core
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%shop_delivery}}';
}
/**
* @inheritdoc
*/
public function behaviors()
{
return ArrayHelper::merge(parent::behaviors(), [
HasStatusBoolean::className() =>
[
'class' => HasStatusBoolean::className(),
]
]);
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return array_merge(parent::attributeLabels(), [
'id' => Yii::t('app', 'ID'),
'created_by' => Yii::t('app', 'Created By'),
'updated_by' => Yii::t('app', 'Updated By'),
'created_at' => Yii::t('app', 'Created At'),
'updated_at' => Yii::t('app', 'Updated At'),
'currency' => Yii::t('app', 'Currency'),
'name' => Yii::t('app', 'Name'),
'description' => Yii::t('app', 'Description'),
'period_from' => Yii::t('app', 'Period From'),
'period_to' => Yii::t('app', 'Period To'),
'period_type' => Yii::t('app', 'Period Type'),
'weight_from' => Yii::t('app', 'Weight From'),
'weight_to' => Yii::t('app', 'Weight To'),
'order_price_from' => Yii::t('app', 'Order Price From'),
'order_price_to' => Yii::t('app', 'Order Price To'),
'order_currency' => Yii::t('app', 'Order Currency'),
'status' => Yii::t('app', 'Status'),
'price' => Yii::t('app', 'Price'),
]);
}
public function scenarios()
{
$scenarios = parent::scenarios();
$scenarios[self::SCENARIO_DEFAULT];
$scenarios['create'] = $scenarios[self::SCENARIO_DEFAULT];
$scenarios['update'] = $scenarios[self::SCENARIO_DEFAULT];
return $scenarios;
}
/**
* @inheritdoc
*/
public function rules()
{
return array_merge(parent::rules(), [
[['created_by', 'updated_by', 'created_at', 'updated_at', 'period_from', 'period_to', 'weight_from', 'weight_to', 'status'], 'integer'],
[['name'], 'required'],
[['description'], 'string'],
[['order_price_from', 'order_price_to', 'price'], 'number'],
[['currency', 'order_currency'], 'string', 'max' => 3],
[['name'], 'string', 'max' => 255],
[['period_type'], 'string', 'max' => 1]
]);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getShopOrders()
{
return $this->hasMany(ShopOrder::className(), ['person_type_id' => 'id']);
}
}
\ No newline at end of file
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 02.04.2015
*/
namespace skeeks\modules\cms\shop\models;
use skeeks\cms\models\behaviors\HasStatus;
use skeeks\cms\models\behaviors\HasStatusBoolean;
use skeeks\cms\models\Core;
use \Yii;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "{{%shop_pay_system}}".
*
* @property integer $id
* @property integer $created_by
* @property integer $updated_by
* @property integer $created_at