Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (56 sloc) 1.37 KB
<?php
/**
* @link https://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license https://craftcms.github.io/license/
*/
namespace craft\commerce\records;
use craft\db\ActiveRecord;
use craft\records\UserGroup;
use yii\db\ActiveQueryInterface;
/**
* Sale user group record.
*
* @property int $id
* @property ActiveQueryInterface $sale
* @property int $saleId
* @property ActiveQueryInterface $userGroup
* @property int $userGroupId
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
* @since 2.0
*/
class SaleUserGroup extends ActiveRecord
{
// Public Methods
// =========================================================================
/**
* @inheritdoc
*/
public static function tableName(): string
{
return '{{%commerce_sale_usergroups}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['saleId', 'userGroupId'], 'unique', 'targetAttribute' => ['saleId', 'userGroupId']]
];
}
/**
* @return ActiveQueryInterface
*/
public function getSale(): ActiveQueryInterface
{
return $this->hasOne(Sale::class, ['saleId' => 'id']);
}
/**
* @return ActiveQueryInterface
*/
public function getUserGroup(): ActiveQueryInterface
{
return $this->hasOne(UserGroup::class, ['saleId' => 'id']);
}
}
You can’t perform that action at this time.