brocode/module-entityservices
最新稳定版本:1.6.0
Composer 安装命令:
composer require brocode/module-entityservices
包简介
Entity services for magento2
README 文档
README
- easy way to update your database without knowledge of underlaying array configs
- creating new EAV entity schemas with just a view lines of code
- add EAV attributes for products, customers, categories without knowledge of the differing subtle differences
###DONE:
- create tables with various columns, indizes, foreign keys
- create a set of tables for a EAV entity
- update tables (add/modify columns, drop foreign keys or indizes)
###Example:
Usage within a Schema upgrade:
class UpgradeSchema implements UpgradeSchemaInterface
{
/**
* @var SchemaBuilder
*/
private $schemaBuilderFactory;
/**
* UpgradeSchema constructor.
* @param SchemaBuilder $schemaBuilderFactory
*/
public function __construct(SchemaBuilderFactory $schemaBuilderFactory) {
$this->schemaBuilderFactory = $schemaBuilderFactory;
}
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.1.0', '<')) {
$this->schemaBuilderFactory->create($setup)->withTable('entity')
->withIntColumn('entity_id')->asIdentiy()->asUnsigned()->asNullable(false)->asPrimaryKey()->build()
->withVarcharColumn('field_id)->asNullable(false)->build()
->withIndex(['field_id'])->build()
->withForeignKey('field_id, 'other_table', 'other_column')->actionNoAction()->build()
->build();
}
$setup->endSetup();
}
}
统计信息
- 总下载量: 13.15k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-23