-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
This issue summarizes the plan to integrate custom field into the fixture plugin.
It should be possible to automatically create custom fields via the FixturePlugin. For this we will create a new base class which is called CustomFieldFixture.
Custom Fields should be able to be created fluently:
<?php
class MyProductFieldSet extends CustomFieldFixture
{
public function getFieldSetInfo(): FieldSetInfo {
return new FieldSetInfo(
name: 'Product Details',
entities: [ProductDefinition::ENTITY_NAME, CategoryDefinition::ENTITY_NAME],
// ...
);
}
// This method is `abstract` in the CustomFieldFixture and must be implemented
public function load(): void {
// All required fields (that have no default value) are in the `intField` method
$this->intField(
name: 'My number field',
technicalName: 'name_123',
)->min(20)->max(10)->create();
}
}Each created field set and custom field should have a flag that marks that this was created by the fixture plugin. With this we can create cleanup strategies that remove all non-existant custom fields again.
In addition new commands should be provided:
bin/console fixture:custom-fields:update
bin/console fixture:custom-fields:cleanup
bin/console fixture:custom-fields:remove-allMetadata
Metadata
Assignees
Labels
No labels