本文整理汇总了PHP中app\models\Property::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Property::save方法的具体用法?PHP Property::save怎么用?PHP Property::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Property
的用法示例。
在下文中一共展示了Property::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPropertyValue
public static function setPropertyValue($key, $value = null)
{
$model = Property::findOne($key);
if (is_null($model)) {
$model = new Property();
$model->id = $key;
}
$model->value = $value;
$model->save();
}
示例2: up
public function up()
{
$submissionObject = Object::getForClass(\app\models\Submission::className());
/** @var PropertyHandler $propertyHandler */
$propertyHandler = PropertyHandler::findOne(['name' => 'Text']);
$this->addColumn(Review::tableName(), 'submission_id', 'INT UNSIGNED NOT NULL');
$form = new \app\models\Form();
$form->name = 'Review form';
$form->email_notification_addresses = '';
$form->email_notification_view = '@app/modules/review/views/review-email-template.php';
$form->save(false, ['name', 'email_notification_addresses', 'email_notification_view']);
$propertyGroup = new PropertyGroup();
$propertyGroup->attributes = ['object_id' => $form->object->id, 'name' => 'Review form additional properties', 'hidden_group_title' => 1];
$propertyGroup->save(true, ['object_id', 'name', 'hidden_group_title']);
$nameProperty = new Property();
$nameProperty->attributes = ['property_group_id' => $propertyGroup->id, 'name' => 'Name', 'key' => 'name', 'property_handler_id' => $propertyHandler->id, 'handler_additional_params' => '{}', 'is_eav' => 1];
$nameProperty->save(true, ['property_group_id', 'name', 'key', 'property_handler_id', 'is_eav', 'handler_additional_params']);
$phoneProperty = new Property();
$phoneProperty->attributes = ['property_group_id' => $propertyGroup->id, 'name' => 'Phone', 'key' => 'phone', 'property_handler_id' => $propertyHandler->id, 'handler_additional_params' => '{}', 'is_eav' => 1];
$phoneProperty->save(true, ['property_group_id', 'name', 'key', 'property_handler_id', 'is_eav', 'handler_additional_params']);
$objectPropertyGroup = new ObjectPropertyGroup();
$objectPropertyGroup->attributes = ['object_id' => $form->object->id, 'object_model_id' => $form->id, 'property_group_id' => $propertyGroup->id];
$objectPropertyGroup->save(true, ['object_id', 'object_model_id', 'property_group_id']);
$reviews = Review::find()->all();
foreach ($reviews as $review) {
$submission = new \app\models\Submission();
$submission->form_id = $form->id;
$submission->processed_by_user_id = $review->author_user_id;
$submission->date_received = $review->date_submitted;
$submission->save(false, ['form_id', 'processed_by_user_id', 'date_received']);
$review->submission_id = $this->db->lastInsertID;
$review->save(true, ['submission_id']);
$this->insert(ObjectPropertyGroup::tableName(), ['object_id' => $submissionObject->id, 'object_model_id' => $submission->id, 'property_group_id' => $propertyGroup->id]);
$this->insert($submissionObject->eav_table_name, ['object_model_id' => $submission->id, 'property_group_id' => $propertyGroup->id, 'key' => $nameProperty->key, 'value' => $review->author_name]);
$this->insert($submissionObject->eav_table_name, ['object_model_id' => $submission->id, 'property_group_id' => $propertyGroup->id, 'key' => $phoneProperty->key, 'value' => $review->author_phone]);
}
$this->dropColumn(Review::tableName(), 'date_submitted');
$this->dropColumn(Review::tableName(), 'author_user_id');
$this->dropColumn(Review::tableName(), 'author_name');
$this->dropColumn(Review::tableName(), 'author_phone');
$this->dropColumn(Review::tableName(), 'rate');
$this->renameColumn(Review::tableName(), 'text', 'review_text');
$this->alterColumn(Review::tableName(), 'rating_id', 'CHAR(32)');
$this->update(BackendMenu::tableName(), ['route' => 'review/backend-rating/index'], ['route' => 'backend/rating/index']);
$this->update(BackendMenu::tableName(), ['route' => 'review/backend-review/index'], ['name' => 'Reviews']);
$this->delete(BackendMenu::tableName(), ['route' => ['review/backend/products', 'review/backend/pages']]);
$this->alterColumn(RatingValues::tableName(), 'rating_id', 'CHAR(32) NOT NULL');
$this->alterColumn(RatingValues::tableName(), 'object_id', 'INT UNSIGNED NOT NULL');
$this->alterColumn(RatingValues::tableName(), 'object_model_id', 'INT UNSIGNED NOT NULL');
$this->alterColumn(RatingValues::tableName(), 'rating_item_id', 'INT UNSIGNED NOT NULL');
$this->alterColumn(RatingValues::tableName(), 'user_id', 'INT UNSIGNED NOT NULL');
$this->createIndex('ix-rating_values-rating_id', RatingValues::tableName(), 'rating_id');
$this->createIndex('ix-rating_values-object_id-object_model_id', RatingValues::tableName(), ['object_id', 'object_model_id']);
$this->createIndex('ix-rating_item-rating_group', RatingItem::tableName(), 'rating_group');
}
示例3: createProperty
protected function createProperty()
{
$userId = Auth::user()->id;
$property = new Property();
$property->name = $this->request->name;
$property->location = $this->request->location;
$property->userId = $userId;
$property->status = 'open';
$bSuccess = $property->save();
if ($bSuccess) {
if ($this->request->hasFile('files')) {
foreach ($this->request->file('files') as $file) {
$fileName = uniqid() . '-' . $file->getClientOriginalName();
$image = new Image();
$image->filename = $fileName;
$image->propertyId = $property->id;
$image->userId = $userId;
$image->save();
$file->move(base_path() . '/public/uploads/', $fileName);
}
}
return redirect('dashboard');
}
}
示例4: up
//.........这里部分代码省略.........
echo "INFO: Using admin user details provided by ENV variables...\n";
$username = getenv("ADMIN_USERNAME");
$email = getenv("ADMIN_EMAIL");
$password = getenv("ADMIN_PASSWORD");
} else {
$stdIn = fopen("php://stdin", "r");
do {
echo 'Enter admin username (3 or more chars): ';
$username = trim(fgets($stdIn));
} while (mb_strlen($username) < 3);
do {
echo 'Enter admin email: ';
$email = trim(fgets($stdIn));
} while (preg_match('#^\\w[\\w\\d\\.\\-_]*@[\\w\\d\\.\\-_]+\\.\\w{2,6}$#i', $email) != 1);
do {
do {
echo 'Enter admin password (8 or more chars): ';
$password = trim(fgets($stdIn));
} while (mb_strlen($password) < 8);
do {
echo 'Confirm admin password: ';
$confirmPassword = trim(fgets($stdIn));
} while (mb_strlen($confirmPassword) < 8);
if ($password != $confirmPassword) {
echo "Password does not match the confirm password\n";
}
} while ($password != $confirmPassword);
fclose($stdIn);
}
$user = new User(['scenario' => 'signup']);
$user->username = $username;
$user->password = $password;
$user->email = $email;
$user->save(false);
if (getenv("INSTALL_RUSSIAN_TRANSLATIONS")) {
echo "INFO: Using translations details provided by ENV variables...\n";
if (trim(strtolower(getenv("INSTALL_RUSSIAN_TRANSLATIONS"))) === 'y') {
Yii::$app->language = 'ru-RU';
}
} else {
$f = fopen('php://stdin', 'r');
echo "Install Russian translations? [y/N] ";
while (true) {
$answer = trim(fgets($f));
if ($answer === 'y' || $answer === 'Y') {
Yii::$app->language = 'ru-RU';
break;
} elseif ($answer === 'n' || $answer === 'N') {
break;
}
echo "Install Russian translations? [y/N]";
}
fclose($f);
}
$this->batchInsert('{{%auth_item}}', ['name', 'type', 'description'], [['admin', '1', Yii::t('app', 'Administrator')], ['manager', '1', Yii::t('app', 'Manager')], ['administrate', '2', Yii::t('app', 'Administrate panel')], ['api manage', '2', Yii::t('app', 'API management')], ['seo manage', '2', Yii::t('app', 'SEO management')], ['task manage', '2', Yii::t('app', 'Task management')], ['user manage', '2', Yii::t('app', 'User management')], ['cache manage', '2', Yii::t('app', 'Cache management')], ['content manage', '2', Yii::t('app', 'Content management')], ['shop manage', '2', Yii::t('app', 'Shop management')], ['order manage', '2', Yii::t('app', 'Order management')], ['category manage', '2', Yii::t('app', 'Category management')], ['product manage', '2', Yii::t('app', 'Product management')], ['property manage', '2', Yii::t('app', 'Property management')], ['view manage', '2', Yii::t('app', 'View management')], ['review manage', '2', Yii::t('app', 'Review management')], ['navigation manage', '2', Yii::t('app', 'Navigation management')], ['form manage', '2', Yii::t('app', 'Form management')], ['media manage', '2', Yii::t('app', 'Media management')], ['order status manage', '2', Yii::t('app', 'Order status management')], ['payment manage', '2', Yii::t('app', 'Payment type management')], ['shipping manage', '2', Yii::t('app', 'Shipping option management')], ['newsletter manage', '2', Yii::t('app', 'Newsletter management')], ['monitoring manage', '2', Yii::t('app', 'Monitoring management')], ['data manage', '2', Yii::t('app', 'Data management')], ['setting manage', '2', Yii::t('app', 'Setting management')]]);
$this->batchInsert('{{%auth_item_child}}', ['parent', 'child'], [['shop manage', 'category manage'], ['shop manage', 'product manage'], ['shop manage', 'order manage'], ['manager', 'administrate'], ['manager', 'content manage'], ['manager', 'order manage'], ['manager', 'shop manage'], ['manager', 'category manage'], ['manager', 'product manage'], ['manager', 'property manage'], ['manager', 'view manage'], ['manager', 'review manage'], ['manager', 'navigation manage'], ['manager', 'form manage'], ['manager', 'media manage'], ['admin', 'administrate'], ['admin', 'api manage'], ['admin', 'order manage'], ['admin', 'seo manage'], ['admin', 'task manage'], ['admin', 'user manage'], ['admin', 'cache manage'], ['admin', 'content manage'], ['admin', 'shop manage'], ['admin', 'category manage'], ['admin', 'product manage'], ['admin', 'property manage'], ['admin', 'view manage'], ['admin', 'review manage'], ['admin', 'navigation manage'], ['admin', 'form manage'], ['admin', 'media manage'], ['admin', 'order status manage'], ['admin', 'payment manage'], ['admin', 'shipping manage'], ['admin', 'monitoring manage'], ['admin', 'newsletter manage'], ['admin', 'data manage'], ['admin', 'setting manage']]);
$this->insert('{{%auth_assignment}}', ['item_name' => 'admin', 'user_id' => $user->id]);
// demo data
$demo = null;
if (getenv("INSTALL_DEMO_DATA")) {
$demo = getenv("INSTALL_DEMO_DATA");
} else {
$stdIn = fopen("php://stdin", "r");
do {
echo 'Do you want to install demo data [y/n]: ';
$demo = strtolower(trim(fgets($stdIn)));
示例5: parseNewhomesourceProperty
//.........这里部分代码省略.........
$httpClient = new GuzzleHttp\Client();
try {
$contents = $httpClient->get($url)->getBody()->getContents();
} catch (GuzzleHttp\Exception\RequestException $e) {
throw new FunFangException("访问 {$url} 时出错!" . $e->getMessage());
}
$html->load($contents);
$planIdEle = $html->find('#PlanId', 0);
if (!$planIdEle) {
throw new FunFangException('您输入的URL可能不正确,解析失败!');
}
$planId = $planIdEle->value;
//先从数据库中查找
if ($planId) {
$record = Property::where('DataSourceId', $dataSourceId)->where('DataId', $planId)->first();
if ($record) {
$html->clear();
return $record;
}
}
//如果数据库中没有记录,从html中解析并保存到数据库
$record = new Property();
$record->DataSourceId = $dataSourceId;
$record->DataId = trim($planId);
$record->ReferenceUrl = $url;
$communityId = $html->find('#CommunityId', 0)->value;
$specId = $html->find('#SpecId', 0)->value;
//照片需要通过另外的API获取,必须的参数:communityId、planId、specId、isPreview
$photoRes = $httpClient->post('http://www.newhomesource.com/detailgetgallery', ['form_params' => ['communityId' => $communityId, 'planId' => $planId, 'specId' => $specId, 'isPreview' => 'False']]);
$photoObj = json_decode($photoRes->getBody()->getContents());
$photoUrls = [];
foreach ($photoObj->PropertyMediaLinks as $photo) {
//type:i是图片,v是视频
if ($photo->Type == 'i') {
array_push($photoUrls, 'http://nhs-dynamic.bdxcdn.com/' . $photo->Url);
}
}
$record->PhotoUrls = implode(',', $photoUrls);
//价格
$listPrice = $html->find('#nhs_DetailsDescriptionAreaWrapper .nhs_DetailsPrice span', 0)->plaintext;
$record->ListPrice = str_replace(',', '', str_replace('$', '', $listPrice));
foreach ($html->find('#nhs_HomeDetailsHeaderBrandHomesSqFt ul li') as $li) {
$text = $li->plaintext;
if (StringUtil::containsIgnoreCase($text, 'Bedrooms')) {
//卧室数
$bedrooms = str_ireplace('Bedrooms', '', $text);
$bedrooms = str_replace(' ', '', $bedrooms);
$record->Bedrooms = $bedrooms;
} else {
if (StringUtil::containsIgnoreCase($text, 'Bathrooms')) {
//浴室数
$bathrooms = str_ireplace('Bathrooms', '', $text);
$bathrooms = str_replace(' ', '', $bathrooms);
$record->BathsFull = intval($bathrooms);
$record->BathsHalf = intval($bathrooms) == $bathrooms ? 0 : 1;
} else {
if (StringUtil::containsIgnoreCase($text, 'sq.ft.')) {
//面积
$structureSqFt = str_ireplace('sq.ft.', '', $text);
$structureSqFt = str_replace(',', '', $structureSqFt);
$record->StructureSqFt = $structureSqFt;
} else {
if (StringUtil::containsIgnoreCase($text, 'Garages')) {
//停车位
$garageSpaces = str_ireplace('Garages', '', $text);
$garageSpaces = str_replace(' ', '', $garageSpaces);
$record->GarageSpaces = $garageSpaces;
}
}
}
}
}
$description = $html->find('#nhs_DetailDescriptionArea', 0)->plaintext;
$description = str_replace(' ', '', $description);
$record->Description = $description;
//解析坐标位置
$jsonStr = $html->find('#nhs_HomeDetailv2 script', 0)->innertext;
$obj = json_decode($jsonStr);
$lat = $obj->Geo->latitude;
$lng = $obj->Geo->longitude;
$addressRes = $httpClient->get("http://ditu.google.cn//maps/api/geocode/json?latlng={$lat},{$lng}");
$addressJson = json_decode($addressRes->getBody()->getContents());
if ($addressJson->status == 'OK') {
$addressObj = GoogleGeoHelper::getAddress($addressJson->results);
}
if ($addressObj) {
$record->State = $addressObj->state;
$record->County = $addressObj->county;
$record->City = $addressObj->city;
$streetNumber = property_exists($addressObj, 'streetNumber') ? $addressObj->streetNumber : '';
$street = property_exists($addressObj, 'street') ? $addressObj->street : '';
$record->Address = "{$streetNumber} {$street}";
$record->PostalCode = $addressObj->postalCode;
//$record->Location = DB::raw("GeomFromText('POINT($addressObj->lng $addressObj->lat)')");
$record->Location = "{$addressObj->lng},{$addressObj->lat}";
}
$record->save();
$html->clear();
return $record;
}
示例6: up
//.........这里部分代码省略.........
$this->batchInsert('{{%auth_item_child}}', ['parent', 'child'], [['shop manage', 'category manage'], ['shop manage', 'product manage'], ['shop manage', 'order manage'], ['manager', 'administrate'], ['manager', 'content manage'], ['manager', 'order manage'], ['manager', 'shop manage'], ['manager', 'category manage'], ['manager', 'product manage'], ['manager', 'property manage'], ['manager', 'view manage'], ['manager', 'review manage'], ['manager', 'navigation manage'], ['manager', 'form manage'], ['manager', 'media manage'], ['admin', 'administrate'], ['admin', 'api manage'], ['admin', 'order manage'], ['admin', 'seo manage'], ['admin', 'task manage'], ['admin', 'user manage'], ['admin', 'cache manage'], ['admin', 'content manage'], ['admin', 'shop manage'], ['admin', 'category manage'], ['admin', 'product manage'], ['admin', 'property manage'], ['admin', 'view manage'], ['admin', 'review manage'], ['admin', 'navigation manage'], ['admin', 'form manage'], ['admin', 'media manage'], ['admin', 'order status manage'], ['admin', 'payment manage'], ['admin', 'shipping manage'], ['admin', 'monitoring manage'], ['admin', 'data manage'], ['admin', 'setting manage']]);
// demo data
//
//
//
$this->insert(Task::tableName(), ['action' => 'seo/sitemap/generate-sitemap', 'type' => Task::TYPE_REPEAT, 'initiator' => 1, 'name' => 'sitemap', 'cron_expression' => '0-59/15 * * * *']);
$this->insert(Task::tableName(), ['action' => 'errornotifier/notify', 'type' => Task::TYPE_REPEAT, 'initiator' => 1, 'name' => 'ErrorMonitor notifier', 'cron_expression' => '*/1 * * * *', 'status' => 'ACTIVE']);
$this->batchInsert(ProductListingSort::tableName(), ['name', 'sort_field', 'asc_desc', 'enabled', 'sort_order'], [['Popularity', 'product.sort_order', 'asc', 1, 0], ['Price 0-9', 'product.price', 'asc', 1, 1], ['Price 9-0', 'product.price', 'desc', 1, 2], ['Name', 'product.name', 'asc', 1, 3], ['Name', 'product.name', 'desc', 1, 4]]);
$this->batchInsert(SliderHandler::tableName(), ['name', 'slider_widget', 'slider_edit_view_file', 'edit_model'], [['Bootstrap 3 carousel', 'app\\slider\\sliders\\bootstrap3\\Bootstrap3CarouselWidget', '@app/slider/sliders/bootstrap3/views/edit', 'app\\slider\\sliders\\bootstrap3\\models\\EditModel'], ['Slick', 'app\\slider\\sliders\\slick\\SlickCarouselWidget', '@app/slider/sliders/slick/views/edit', 'app\\slider\\sliders\\slick\\models\\EditModel']]);
$this->batchInsert(Slider::tableName(), ['name', 'slider_handler_id', 'image_width', 'image_height'], [['Example carousel', 1, 900, 350]]);
$this->batchInsert(Slide::tableName(), ['slider_id', 'sort_order', 'image', 'link'], [[1, 1, 'http://st-1.dotplant.ru/img/dotplant-slider-demo/slide-1.jpg', '#1'], [1, 2, 'http://st-1.dotplant.ru/img/dotplant-slider-demo/slide-2.jpg', '#2'], [1, 3, 'http://st-1.dotplant.ru/img/dotplant-slider-demo/slide-3.jpg', '#3']]);
$this->insert(CurrencyRateProvider::tableName(), ['name' => 'Google Finance', 'class_name' => 'Swap\\Provider\\GoogleFinanceProvider']);
$this->insert(CurrencyRateProvider::tableName(), ['name' => 'Cbr Finance', 'class_name' => 'app\\components\\swap\\provider\\CbrFinanceProvider']);
$this->insert(Currency::tableName(), ['name' => 'Ruble', 'iso_code' => 'RUB', 'is_main' => 1, 'format_string' => '# руб.', 'intl_formatting' => 0]);
$this->insert(Currency::tableName(), ['name' => 'US Dollar', 'iso_code' => 'USD', 'convert_nominal' => 1, 'convert_rate' => 62.8353, 'sort_order' => 1, 'format_string' => '$ #', 'thousands_sep' => '.', 'dec_point' => ',']);
$this->insert(Currency::tableName(), ['name' => 'Euro', 'iso_code' => 'EUR', 'convert_rate' => 71.32429999999999, 'format_string' => '€ #']);
$this->insert(Task::tableName(), ['action' => 'currency/update', 'type' => 'REPEAT', 'initiator' => 1, 'name' => 'Currency update', 'cron_expression' => '0 0 * * *']);
$this->insert(Country::tableName(), ['name' => 'Россия', 'iso_code' => 'RUS', 'sort_order' => 0, 'slug' => 'rossiya']);
$this->insert(Country::tableName(), ['name' => 'USA', 'iso_code' => 'USA', 'sort_order' => 1, 'slug' => 'usa']);
$this->insert(City::tableName(), ['name' => 'Москва', 'slug' => 'moscow', 'country_id' => 1]);
$this->insert(City::tableName(), ['name' => 'Санкт-Петербург', 'slug' => 'spb', 'country_id' => 1]);
$this->insert(City::tableName(), ['name' => 'New York', 'slug' => 'ny', 'country_id' => 2]);
$this->insert(Warehouse::tableName(), ['name' => 'Main warehouse', 'country_id' => 1, 'city_id' => 1, 'address' => 'Kremlin']);
$this->insert(WarehousePhone::tableName(), ['name' => 'Sales', 'warehouse_id' => 1, 'phone' => '+7 (495) 123-45-67']);
$this->insert(WarehouseEmail::tableName(), ['name' => 'Sales', 'warehouse_id' => 1, 'email' => 'moscow@example.com']);
$this->insert(WarehouseOpeninghours::tableName(), ['warehouse_id' => 1, 'monday' => 1, 'tuesday' => 1, 'wednesday' => 1, 'thursday' => 1, 'friday' => 1, 'saturday' => 1, 'sunday' => 1, 'all_day' => 1, 'opens' => '', 'closes' => '', 'break_from' => '12:00', 'break_to' => '13:00']);
$this->insert(Warehouse::tableName(), ['name' => 'Second warehouse', 'country_id' => 2, 'city_id' => 3, 'address' => 'The WallStreet hidden warehouse']);
$this->insert(WarehousePhone::tableName(), ['name' => 'Sales', 'warehouse_id' => 2, 'phone' => '+1 800 1-WAREHOUSE-1']);
$this->insert(WarehouseEmail::tableName(), ['name' => 'Sales', 'warehouse_id' => 2, 'email' => 'nyc@example.com']);
$this->insert(WarehouseOpeninghours::tableName(), ['warehouse_id' => 2, 'monday' => 1, 'tuesday' => 1, 'wednesday' => 1, 'thursday' => 1, 'friday' => 0, 'saturday' => 0, 'sunday' => 1, 'all_day' => 0, 'opens' => '9:00', 'closes' => '22:00', 'break_from' => '', 'break_to' => '']);
$this->batchInsert(Object::tableName(), ['name', 'object_class', 'object_table_name', 'column_properties_table_name', 'eav_table_name', 'categories_table_name', 'link_slug_category', 'link_slug_static_value', 'object_slug_attribute'], [['Property', Property::className(), Yii::$app->db->schema->getRawTableName(Property::tableName()), Yii::$app->db->schema->getRawTableName('{{%property_property}}'), Yii::$app->db->schema->getRawTableName('{{%property_eav}}'), Yii::$app->db->schema->getRawTableName('{{%property_category}}'), Yii::$app->db->schema->getRawTableName('{{%property_category_full_slug}}'), Yii::$app->db->schema->getRawTableName('{{%property_static_value_category}}'), 'slug'], ['PropertyStaticValues', PropertyStaticValues::className(), Yii::$app->db->schema->getRawTableName(PropertyStaticValues::tableName()), Yii::$app->db->schema->getRawTableName('{{%property_static_values_properties}}'), Yii::$app->db->schema->getRawTableName('{{%property_static_values_eav}}'), Yii::$app->db->schema->getRawTableName('{{%property_static_values_category}}'), Yii::$app->db->schema->getRawTableName('{{%property_static_values_category_full_slug}}'), Yii::$app->db->schema->getRawTableName('{{%property_static_values_static_value_category}}'), 'slug']]);
$clearTask = new Task();
$clearTask->setAttributes(['action' => 'background/tasks/clear-old-notifications', 'type' => Task::TYPE_REPEAT, 'initiator' => 1, 'name' => 'Clear old notify messages', 'cron_expression' => '*/1 * * * *', 'status' => 'ACTIVE']);
$clearTask->save();
$spamTask = new Task();
$spamTask->setAttributes(['action' => 'submissions/mark-spam', 'type' => Task::TYPE_REPEAT, 'initiator' => 1, 'name' => 'Mark spam submissions as deleted', 'cron_expression' => '* * */1 * *', 'status' => 'ACTIVE']);
$spamTask->save();
$clearTask = new Task();
$clearTask->setAttributes(['action' => 'submissions/clear-deleted', 'type' => Task::TYPE_REPEAT, 'initiator' => 1, 'name' => 'Clear deleted submissions', 'cron_expression' => '* * */3 * *', 'status' => 'ACTIVE']);
$clearTask->save();
$this->batchInsert(SpamChecker::tableName(), ['behavior', 'name', 'author_field', 'content_field'], [['app\\behaviors\\spamchecker\\AkismetSpamChecker', 'Akismet', 'comment_author', 'comment_content']]);
$this->insert(ThumbnailSize::tableName(), ['width' => 80, 'height' => 80]);
$this->insert(Task::tableName(), ['action' => 'images/check-broken', 'type' => Task::TYPE_REPEAT, 'initiator' => 1, 'name' => 'Check broken images', 'cron_expression' => '* */1 * * *']);
$this->insert(ContentDecorator::tableName(), ['added_by_ext' => 'core', 'post_decorator' => 0, 'class_name' => 'app\\modules\\core\\decorators\\ContentBlock']);
$this->insert(Events::tableName(), ['owner_class_name' => 'app\\modules\\shop\\ShopModule', 'event_name' => 'product_page_showed', 'event_class_name' => 'app\\modules\\shop\\events\\ProductPageShowed', 'event_description' => 'Product page is showed to user', 'documentation_link' => '']);
$this->insert(Events::tableName(), ['owner_class_name' => 'app\\modules\\shop\\ShopModule', 'event_name' => 'product_showed_in_list', 'event_class_name' => 'app\\modules\\shop\\events\\ProductShowedInList', 'event_description' => 'Product is showed in product listing(shop/product/list)', 'documentation_link' => '']);
$this->insert(Events::tableName(), ['owner_class_name' => 'app\\modules\\shop\\ShopModule', 'event_name' => 'product_category_listed', 'event_class_name' => 'app\\modules\\shop\\events\\ProductCategoryListed', 'event_description' => 'Category is listed by shop/product/list as last_category_id.', 'documentation_link' => '']);
$this->insert(EventHandlers::tableName(), ['event_id' => 1, 'sort_order' => 1, 'handler_class_name' => 'app\\modules\\shop\\helpers\\LastViewedProducts', 'handler_function_name' => 'handleProductShowed', 'non_deletable' => 1, 'triggering_type' => EventTriggeringHelper::TYPE_APPLICATION]);
$this->insert(ExtensionTypes::tableName(), ['name' => 'Theme']);
$this->insert(ExtensionTypes::tableName(), ['name' => 'Module']);
$this->insert(ExtensionTypes::tableName(), ['name' => 'Frontend widget']);
$this->insert(ExtensionTypes::tableName(), ['name' => 'Dashboard widget']);
$this->insert(ExtensionTypes::tableName(), ['name' => 'Backend input widget']);
$this->batchInsert(DiscountType::tableName(), ['name', 'class', 'checking_class', 'add_view'], [['Discount Code', 'app\\modules\\shop\\models\\DiscountCode', 'Order', '@app/modules/shop/views/backend-discount/_discount_code'], ['Category Discount', 'app\\modules\\shop\\models\\CategoryDiscount', 'OrderItem', '@app/modules/shop/views/backend-discount/_category_discount'], ['User Discount', 'app\\modules\\shop\\models\\UserDiscount', 'Order', '@app/modules/shop/views/backend-discount/_user_discount'], ['Order Discount', 'app\\modules\\shop\\models\\OrderDiscount', 'Order', '@app/modules/shop/views/backend-discount/_order_discount'], ['Product Discount', 'app\\modules\\shop\\models\\ProductDiscount', 'OrderItem', '@app/modules/shop/views/backend-discount/_product_discount']]);
$this->batchInsert(SpecialPriceList::tableName(), ['object_id', 'class', 'sort_order', 'type', 'handler'], [[\app\models\Object::getForClass(\app\modules\shop\models\Product::className())->id, 'app\\modules\\shop\\helpers\\PriceHandlers', 5, 'core', 'getCurrencyPriceProduct'], [\app\models\Object::getForClass(\app\modules\shop\models\Order::className())->id, 'app\\modules\\shop\\helpers\\PriceHandlers', 10, 'delivery', 'getDeliveryPriceOrder'], [\app\models\Object::getForClass(\app\modules\shop\models\Product::className())->id, 'app\\modules\\shop\\helpers\\PriceHandlers', 15, 'discount', 'getDiscountPriceProduct'], [\app\models\Object::getForClass(\app\modules\shop\models\Order::className())->id, 'app\\modules\\shop\\helpers\\PriceHandlers', 20, 'discount', 'getDiscountPriceOrder']]);
$this->insert(Object::tableName(), ['name' => 'Customer', 'object_class' => 'app\\modules\\shop\\models\\Customer', 'object_table_name' => 'customer', 'column_properties_table_name' => 'customer_property', 'eav_table_name' => 'customer_eav', 'categories_table_name' => 'customer_category', 'link_slug_category' => 'customer_category_slug', 'link_slug_static_value' => 'customer_slug_static', 'object_slug_attribute' => 'slug']);
$this->insert(Object::tableName(), ['name' => 'Contragent', 'object_class' => 'app\\modules\\shop\\models\\Contragent', 'object_table_name' => 'contragent', 'column_properties_table_name' => 'contragent_property', 'eav_table_name' => 'contragent_eav', 'categories_table_name' => 'contragent_category', 'link_slug_category' => 'contragent_category_slug', 'link_slug_static_value' => 'contragent_slug_static', 'object_slug_attribute' => 'slug']);
$this->insert(Object::tableName(), ['name' => 'OrderDeliveryInformation', 'object_class' => 'app\\modules\\shop\\models\\OrderDeliveryInformation', 'object_table_name' => 'order_delivery_information', 'column_properties_table_name' => 'order_delivery_information_property', 'eav_table_name' => 'order_delivery_information_eav', 'categories_table_name' => 'order_delivery_information_category', 'link_slug_category' => 'order_delivery_information_category_slug', 'link_slug_static_value' => 'order_delivery_information_slug_static', 'object_slug_attribute' => 'slug']);
$this->insert(Events::tableName(), ['owner_class_name' => 'app\\modules\\shop\\ShopModule', 'event_name' => 'order_stage_customer', 'event_class_name' => 'app\\modules\\shop\\events\\StageCustomer', 'selector_prefix' => '', 'event_description' => '', 'documentation_link' => '']);
$eventId = $this->db->lastInsertID;
$this->insert(EventHandlers::tableName(), ['event_id' => $eventId, 'sort_order' => 0, 'handler_class_name' => 'app\\modules\\shop\\helpers\\BaseOrderStageHandlers', 'handler_function_name' => 'handleStageCustomer', 'is_active' => 1, 'non_deletable' => 0, 'triggering_type' => 'application_trigger']);
$this->insert(Events::tableName(), ['owner_class_name' => 'app\\modules\\shop\\ShopModule', 'event_name' => 'order_stage_delivery', 'event_class_name' => 'app\\modules\\shop\\events\\StageDelivery', 'selector_prefix' => '', 'event_description' => '', 'documentation_link' => '']);
$eventId = $this->db->lastInsertID;
$this->insert(EventHandlers::tableName(), ['event_id' => $eventId, 'sort_order' => 0, 'handler_class_name' => 'app\\modules\\shop\\helpers\\BaseOrderStageHandlers', 'handler_function_name' => 'handleStageDelivery', 'is_active' => 1, 'non_deletable' => 0, 'triggering_type' => 'application_trigger']);
$this->insert(Events::tableName(), ['owner_class_name' => 'app\\modules\\shop\\ShopModule', 'event_name' => 'order_stage_payment', 'event_class_name' => 'app\\modules\\shop\\events\\StagePayment', 'selector_prefix' => '', 'event_description' => '', 'documentation_link' => '']);
$eventId = $this->db->lastInsertID;