namespace common\models;
use common\models\query\ExtendedActiveQuery;
use common\models\traits\MainCompanyClipartTrait;
use Yii;
use yii\db\ActiveRecord;
/**
* This is the model class for table "main_company_clipart".
* @property int $id
* @property int $card_image_id
* @property int $card_icon_id
* @property int $search_product_icon_id
* @property int $search_product_image_id
* @property int $authorisation_icon_id
* @property int $authorisation_image_id
* @property int $empty_orders_icon_id
* @property int $empty_orders_image_id
* @property int $empty_favorite_icon_id
* @property int $empty_favorite_image_id
* @property int $empty_notification_icon_id
* @property int $empty_notification_image_id
*/
class MainCompanyClipart extends ActiveRecord
{
use MainCompanyClipartTrait;
public static function tableName()
{
return '{{%main_company_clipart}}';
}
public static function findOrCreate($id)
{
$companyClipart = self::findOne(['main_company_id' => $id]);
if (!$companyClipart) {
$companyClipart = new MainCompanyClipart(['main_company_id' => $id]);
}
return $companyClipart;
}
public static function find()
{
return Yii::createObject(ExtendedActiveQuery::className(), [get_called_class()]);
// return Yii::createObject(ExtendedActiveQuery::className(), [get_called_class()]);
}
public function rules()
{
return [
[['main_company_id'], 'required'],
[['main_company_id', 'card_image_id', 'card_icon_id', 'search_product_icon_id', 'search_product_image_id', 'authorisation_icon_id', 'authorisation_image_id', 'empty_orders_icon_id', 'empty_orders_image_id', 'empty_favorite_icon_id', 'empty_favorite_image_id', 'empty_notification_icon_id', 'empty_notification_image_id'], 'integer']
];
}
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=mydatabase',
'username' => 'root',
'password' => '',
'enableSchemaCache' => true,
// Duration of schema cache.
'schemaCacheDuration' => 3600,
// Name of the cache component used to store schema information
'schemaCache' => 'cache',
],