Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (55 sloc) 1.39 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 yii\db\ActiveQueryInterface;
/**
* Taz zone country
*
* @property ActiveQueryInterface $country
* @property int $countryId
* @property int $id
* @property ActiveQueryInterface $shippingZone
* @property int $shippingZoneId
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
* @since 2.0
*/
class ShippingZoneCountry extends ActiveRecord
{
// Public Methods
// =========================================================================
/**
* @inheritdoc
*/
public static function tableName(): string
{
return '{{%commerce_shippingzone_countries}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['shippingZoneId', 'countryId'], 'unique', 'targetAttribute' => ['shippingZoneId', 'countryId']]
];
}
/**
* @return ActiveQueryInterface
*/
public function getShippingZone(): ActiveQueryInterface
{
return $this->hasOne(ShippingZone::class, ['id' => 'shippingZoneId']);
}
/**
* @return ActiveQueryInterface
*/
public function getCountry(): ActiveQueryInterface
{
return $this->hasOne(Country::class, ['id' => 'countryId']);
}
}
You can’t perform that action at this time.