本文整理汇总了PHP中app\models\Object::tableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::tableName方法的具体用法?PHP Object::tableName怎么用?PHP Object::tableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Object
的用法示例。
在下文中一共展示了Object::tableName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionClearTests
/**
* Clear test review, orders and other information
* @throws \yii\db\Exception
*/
public function actionClearTests()
{
Yii::$app->db->createCommand('TRUNCATE TABLE ' . app\models\ErrorLog::tableName())->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE ' . app\models\ErrorUrl::tableName())->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE ' . app\backend\models\Notification::tableName())->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE ' . app\modules\shop\models\Order::tableName())->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE ' . app\modules\shop\models\OrderItem::tableName())->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE ' . app\modules\shop\models\OrderTransaction::tableName())->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE ' . app\backend\models\OrderChat::tableName())->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE {{%order_category}}')->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE {{%order_eav}}')->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE {{%order_property}}')->execute();
// Yii::$app->db->createCommand('TRUNCATE TABLE ' . app\reviews\models\Review::tableName())->execute(); @todo need to implement correct reviews deleting
Yii::$app->db->createCommand('TRUNCATE TABLE ' . app\models\Submission::tableName())->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE {{%submission_category}}')->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE {{%submission_eav}}')->execute();
Yii::$app->db->createCommand('TRUNCATE TABLE {{%submission_property}}')->execute();
Yii::$app->db->createCommand('DELETE FROM ' . app\models\ObjectPropertyGroup::tableName() . ' WHERE `object_id` IN (SELECT `id` FROM ' . app\models\Object::tableName() . ' WHERE `object_class` IN (\'app\\models\\Submission\', \'app\\models\\Order\'))')->execute();
Yii::$app->db->createCommand('DELETE FROM ' . app\models\ObjectStaticValues::tableName() . ' WHERE `object_id` IN (SELECT `id` FROM ' . app\models\Object::tableName() . ' WHERE `object_class` IN (\'app\\models\\Submission\', \'app\\models\\Order\'))')->execute();
}
示例2: up
public function up()
{
// @todo Need to add indexes to all tables below
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
// Order
$this->renameColumn(Order::tableName(), 'order_status_id', 'order_stage_id');
$this->addColumn(Order::tableName(), 'assigned_id', 'INT UNSIGNED DEFAULT NULL AFTER `payment_type_id`');
$this->addColumn(Order::tableName(), 'tax_id', 'INT UNSIGNED DEFAULT NULL AFTER `assigned_id`');
$this->addColumn(Order::tableName(), 'update_date', 'TIMESTAMP AFTER `start_date`');
$this->addColumn(Order::tableName(), 'shipping_price', 'FLOAT DEFAULT \'0\' AFTER `total_price`');
$this->addColumn(Order::tableName(), 'total_price_with_shipping', 'FLOAT DEFAULT \'0\' AFTER `shipping_price`');
$this->addColumn(Order::tableName(), 'total_payed', 'FLOAT DEFAULT \'0\' AFTER `total_price_with_shipping`');
$this->addColumn(Order::tableName(), 'temporary', 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 1');
$this->addColumn(Order::tableName(), 'show_price_changed_notification', 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0');
// OrderItem
$this->addColumn(OrderItem::tableName(), 'parent_id', 'INT UNSIGNED NOT NULL DEFAULT 0 AFTER `id`');
$this->addColumn(OrderItem::tableName(), 'custom_name', 'VARCHAR(255) AFTER `product_id`');
$this->addColumn(OrderItem::tableName(), 'price_per_pcs', 'FLOAT NOT NULL DEFAULT \'0\'');
$this->addColumn(OrderItem::tableName(), 'total_price_without_discount', 'FLOAT NOT NULL DEFAULT \'0\'');
$this->addColumn(OrderItem::tableName(), 'lock_product_price', 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0');
$this->addColumn(OrderItem::tableName(), 'discount_amount', 'FLOAT NOT NULL DEFAULT \'0\'');
$this->addColumn(OrderItem::tableName(), 'total_price', 'FLOAT NOT NULL DEFAULT \'0\'');
$this->alterColumn(OrderItem::tableName(), 'quantity', 'FLOAT NOT NULL DEFAULT \'1\'');
$this->dropColumn(OrderItem::tableName(), 'additional_options');
// OrderStage
$this->createTable(OrderStage::tableName(), ['id' => 'INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT', 'name' => 'VARCHAR(255) NOT NULL', 'name_frontend' => 'VARCHAR(255) DEFAULT NULL', 'name_short' => 'VARCHAR(255) DEFAULT NULL', 'is_initial' => 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0', 'is_buyer_stage' => 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0', 'become_non_temporary' => 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0', 'is_in_cart' => 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0', 'immutable_by_user' => 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 1', 'immutable_by_manager' => 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0', 'immutable_by_assigned' => 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0', 'reach_goal_ym' => 'VARCHAR(255) DEFAULT NULL', 'reach_goal_ga' => 'VARCHAR(255) DEFAULT NULL', 'event_name' => 'VARCHAR(255) DEFAULT NULL', 'view' => 'VARCHAR(255) DEFAULT NULL'], $tableOptions);
// OrderStageLeaf
$this->createTable(OrderStageLeaf::tableName(), ['id' => 'INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT', 'stage_from_id' => 'INT UNSIGNED NOT NULL', 'stage_to_id' => 'INT UNSIGNED NOT NULL', 'sort_order' => 'INT NOT NULL DEFAULT 0', 'button_label' => 'VARCHAR(255) NOT NULL', 'button_css_class' => 'VARCHAR(255) DEFAULT NULL', 'notify_buyer' => 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 0', 'buyer_notification_view' => 'VARCHAR(255) DEFAULT NULL', 'notify_manager' => 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 1', 'manager_notification_view' => 'VARCHAR(255) DEFAULT NULL', 'assign_to_user_id' => 'INT UNSIGNED NOT NULL DEFAULT 0', 'assign_to_role' => 'VARCHAR(255) DEFAULT NULL', 'notify_new_assigned_user' => 'TINYINT(1) UNSIGNED NOT NULL DEFAULT 1', 'role_assignment_policy' => "ENUM('random','fair_distribution','last_picked_from_role')", 'event_name' => 'VARCHAR(255) DEFAULT NULL'], $tableOptions);
// Update Object model data
$this->update(Object::tableName(), ['object_class' => 'app\\modules\\shop\\models\\Category'], ['object_class' => 'app\\models\\Category']);
$this->update(Object::tableName(), ['object_class' => 'app\\modules\\shop\\models\\Product'], ['object_class' => 'app\\models\\Product']);
$this->update(Object::tableName(), ['object_class' => 'app\\modules\\shop\\models\\Order'], ['object_class' => 'app\\models\\Order']);
// Update DynamicContent model data
$this->update(DynamicContent::tableName(), ['route' => 'shop/product/list'], ['route' => 'product/list']);
$this->update(DynamicContent::tableName(), ['route' => 'shop/product/show'], ['route' => 'product/show']);
// Update Route model data
$this->update(Route::tableName(), ['route' => 'shop/product/list'], ['route' => 'product/list']);
$this->update(Route::tableName(), ['route' => 'shop/product/show'], ['route' => 'product/show']);
}
示例3: getSelectArray
/**
* Возвращает список всех объектов
* Ключ - ID
* Значение - name
* Используется для фильтрации в таблицах и выборе объекта в форме
*/
public static function getSelectArray()
{
if (static::$select_array_cache === null) {
static::$select_array_cache = Yii::$app->cache->get('ObjectsList');
if (static::$select_array_cache === false) {
$rows = (new Query())->select('id, name')->from(Object::tableName())->all();
static::$select_array_cache = ArrayHelper::map($rows, 'id', 'name');
}
Yii::$app->cache->set('ObjectsList', static::$select_array_cache, 86400, new TagDependency(['tags' => [\devgroup\TagDependencyHelper\ActiveRecordHelper::getCommonTag(static::className())]]));
}
return static::$select_array_cache;
}
示例4: down
public function down()
{
$this->dropTable('{{%user_category}}');
$this->dropTable('{{%user_eav}}');
$this->dropTable('{{%user_property}}');
$this->dropTable(UserService::tableName());
$this->dropTable(User::tableName());
$this->dropTable('{{%auth_assignment}}');
$this->dropTable('{{%auth_item_child}}');
$this->dropTable('{{%auth_item}}');
$this->dropTable('{{%auth_rule}}');
$this->dropTable(ErrorUrl::tableName());
$this->dropTable(ErrorLog::tableName());
$this->dropTable(Review::tableName());
$this->dropTable(Notification::tableName());
$this->dropTable('{{%submission_eav}}');
$this->dropTable('{{%submission_category}}');
$this->dropTable('{{%submission_property}}');
$this->dropTable(Submission::tableName());
$this->dropTable('{{%form_property}}');
$this->dropTable('{{%form_eav}}');
$this->dropTable(Form::tableName());
$this->dropTable('{{%order_category}}');
$this->dropTable('{{%order_eav}}');
$this->dropTable('{{%order_property}}');
$this->dropTable(PaymentType::tableName());
$this->dropTable(ShippingOption::tableName());
$this->dropTable(OrderChat::tableName());
$this->dropTable(OrderTransaction::tableName());
$this->dropTable(OrderItem::tableName());
$this->dropTable(Order::tableName());
$this->dropTable(SubscribeEmail::tableName());
$this->dropTable(CategoryGroupRouteTemplates::tableName());
$this->dropTable('{{%product_category}}');
$this->dropTable('{{%property_category}}');
$this->dropTable('{{%category_eav}}');
$this->dropTable(Category::tableName());
$this->dropTable(CategoryGroup::tableName());
$this->dropTable('{{%page_eav}}');
$this->dropTable('{{%page_category}}');
$this->dropTable('{{%page_property}}');
$this->dropTable(Page::tableName());
$this->dropTable(ViewObject::tableName());
$this->dropTable(View::tableName());
$this->dropTable(Layout::tableName());
$this->dropTable('{{%product_property}}');
$this->dropTable(Product::tableName());
$this->dropTable(Property::tableName());
$this->dropTable(Route::tableName());
$this->dropTable('{{%product_eav}}');
$this->dropTable('{{%product_static_value_full_slug}}');
$this->dropTable('{{%product_category_full_slug}}');
$this->dropTable(PropertyStaticValues::tableName());
$this->dropTable(PropertyHandler::tableName());
$this->dropTable(PropertyGroup::tableName());
$this->dropTable(ObjectStaticValues::tableName());
$this->dropTable(ObjectPropertyGroup::tableName());
$this->dropTable(Object::tableName());
$this->dropTable(DynamicContent::tableName());
$this->dropTable(Navigation::tableName());
$this->dropTable(Image::tableName());
$this->dropTable('{{%session}}');
$this->dropTable(ApiService::tableName());
}
示例5: up
public function up()
{
$this->insert(Object::tableName(), ['name' => 'Navigation', 'object_class' => Navigation::className(), 'object_table_name' => Yii::$app->db->schema->getRawTableName(Navigation::tableName()), 'column_properties_table_name' => Yii::$app->db->schema->getRawTableName('{{%navigation_property}}'), 'eav_table_name' => Yii::$app->db->schema->getRawTableName('{{%navigation_eav}}'), 'categories_table_name' => Yii::$app->db->schema->getRawTableName('{{%navigation_category}}'), 'link_slug_category' => Yii::$app->db->schema->getRawTableName('{{%navigation_category_full_slug}}'), 'link_slug_static_value' => Yii::$app->db->schema->getRawTableName('{{%navigation_static_value_category}}'), 'object_slug_attribute' => 'slug']);
}
示例6: down
public function down()
{
$this->delete(Object::tableName(), ['object_class' => [Property::className(), PropertyStaticValues::className()]]);
}