nelmio / alice

Expressive fixtures generator
MIT License
2.49k stars 330 forks source link

bring back the named constructor #1162

Open c33s opened 7 months ago

c33s commented 7 months ago

i am migrating an older symfony project to 7.0 where i also updated alice.

sadly alice made a big step back, according the readme the constructor now has to be an array

    service_text:
        __construct:
            name: Name
            short_name: editorial
            percent: 93
            icon: basic-book-pen
            description: Description
            visible: true
            rank: 60
vvv
    service_text:
        __construct:
            - Name
            - editorial
            - 93
            - basic-book-pen
            - Description
            - true
            - 60

rewriting all the fixtures and removing valuable information to have a result which is much less readable feels more than wrong. having php supporting named arguments while removing names from alice feels wrong for me.

any chance to get back name constructor?

theofidry commented 7 months ago

any chance to get back name constructor?

Unlikely unless someone is willing to work on it :)

having php supporting named arguments while removing names from alice feels wrong for me.

If PHP supported it at that time I would not have done it, but this is from 7-8 years ago

c33s commented 7 months ago

or would some kind of a hack be acceptible? check if it is a named array and convert it to a values array should do the trick. would this be hard to implement?

theofidry commented 7 months ago

I honestly have no idea what it would take, but given the current architecture I wouldn't think it would be too hard to implement. It's been a really long time since I took a close look at the codebase though so I could be wrong.