Skip to content

Custom Fields #82

@jkniest

Description

@jkniest

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-all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions