-
-
Notifications
You must be signed in to change notification settings - Fork 26
Description
TLDR Context
When implementing plugins for Sylius, I usually add fixtures - that way app developer can "in one click" try plugin (without eating time to add some data manually).
Sometime plugins extending core resources (Product, Order, etc) and I believe we should have safe way to extend or even decorate *ExampleFactory for core resources.
Safe means that solution should work even if 2 or more plugins will be installed that make changes to same *ExampleFactory. This can be done with decorators I believe.
But methods at *ExampleFactory and *Factory protected which make that impossible to create safe solutions.
Describe the proposed solution
- Replace:
protected function configureResourceNode(ArrayNodeDefinition $resourceNode): void;with
public function configureResourceNode(ArrayNodeDefinition $resourceNode): void;at AbstractResourceFixture and related core resources fixtures.
- Add
ConfigurableExampleFactoryInterface(orDecorableExampleFactoryInterface, not sure about name) - optional
interface ConfigurableExampleFactoryInterface extends ExampleFactoryInterface
{
public function configureOptions(OptionsResolver $resolver): void;
}- Replace
AbstractExampleFactorywith:
abstract class AbstractExampleFactory implements ConfigurableExampleFactoryInterface
{
abstract public function configureOptions(OptionsResolver $resolver): void;
}Additional context
As far as currently we have some BC breaking changes in this area ("Make FixturesBundle standalone") - I believe this is good time to do proposed change too.
I will make PR - just let me know please to what branch I should base it to.