$customEntity =
[ 'name' => 'custom_entity_extension',
'fields' => '[{"name":"product","reference":"product","onDelete":"set-null","inherited":true,"type":"one-to-one"}]',
];
$updater =
new SchemaUpdater();
$updater->
applyCustomEntities($schema,
[$customEntity]);
$this->
assertColumns($schema, 'product',
['customentityextensionproduct'
]);
$productTable =
$schema->
getTable('product'
);
$columnComment =
$productTable->
getColumn('customentityextensionproduct'
)->
getComment();
static::
assertSame('custom-entity-element',
$columnComment);
} public function testBlogExample(): void
{ $entities =
[ [ 'name' => 'custom_entity_blog',
'fields' => '[{"name":"position","storeApiAware":true,"type":"int","required":false},{"name":"rating","storeApiAware":true,"type":"float","required":false},{"name":"title","storeApiAware":true,"type":"string","translatable":true,"required":true},{"name":"content","storeApiAware":true,"allowHtml":true,"type":"text","translatable":true,"required":false},{"name":"products","storeApiAware":true,"reference":"product","inherited":false,"onDelete":"cascade","type":"many-to-many"},{"name":"top_seller","storeApiAware":true,"reference":"product","inherited":false,"onDelete":"set-null","type":"many-to-one","required":false},{"name":"comments","storeApiAware":true,"reference":"custom_entity_blog_comment","inherited":false,"onDelete":"set-null","type":"one-to-many","reverseRequired":false},{"name":"author","storeApiAware":false,"reference":"user","inherited":false,"onDelete":"set-null","type":"one-to-one","required":false}]',
],
[