This commit is contained in:
2024-05-24 15:27:07 +03:00
parent 17df2ce6a9
commit fc1da2c238
643 changed files with 110185 additions and 231 deletions

View File

@ -0,0 +1,26 @@
<?php
namespace console\controllers;
use OpenApi\Annotations\OpenApi;
use yii\console\Controller;
use Yii;
use yii\console\ExitCode;
use yii\helpers\Console;
class SwaggerController extends Controller
{
public function actionGo()
{
$openApi = \OpenApi\Generator::scan([Yii::getAlias("@frontend/modules/api")]);
$file = Yii::getAlias('@frontend/web/api-doc/dist/swagger.yaml');
$handle = fopen($file, 'wb');
fwrite($handle, $openApi->toYaml());
fclose($handle);
echo $this->ansiFormat('Created \n", Console::FG_BLUE');
return ExitCode::OK;
}
}

View File

@ -0,0 +1,62 @@
<?php
use yii\db\Migration;
/**
* Class m240507_141733_add_category_id_column_at_product_table
*/
class m240507_141733_add_category_id_column_at_product_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('product', 'product_category_id', $this->integer(11)->defaultValue(0)->notNull());
$this->createIndex('idx-product-product_category_id', 'product', 'product_category_id');
$this->addForeignKey(
'fk-product-product_category_id',
'product',
'product_category_id',
'product_category',
'id',
'CASCADE'
);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey(
'fk-product-product_category_id',
'product'
);
// drops index for column `author_id`
$this->dropIndex(
'idx-product-product_category_id',
'product'
);
$this->dropColumn('product', 'product_category_id');
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m240507_141733_add_category_id_column_at_product_table cannot be reverted.\n";
return false;
}
*/
}