nelmio / alice

Expressive fixtures generator
MIT License
2.5k stars 329 forks source link

Access to reference to set array key #951

Open welcoMattic opened 6 years ago

welcoMattic commented 6 years ago

Hi!

I'm trying to write a bit complex fixtures file. I would like to generate an array with dynamic keys, here is a example:

App\Entity\Project:
    project_1:
        name: 'Videomusic Project'
        artist_name: '@tag_*'
        programs:
            - !php/const App\Enum\Program::CLIP
            - !php/const App\Enum\Program::MOVIE
        calendar:
            - '@self->programs[0]': <dateTimeThisYear()>
            - '@self->programs[1]': <dateTimeThisYear()>

My issue is that @self->programs[0] doesn't work, it's inserted in DB as text.

Is there any solution to generate array keys from reference?

theofidry commented 6 years ago

There is two solution:

Unfortunately I cannot really point where to go for the work to be done, one just really need to dig into it. That said the contribution guide should help out with giving an overview of the architecture.

Also note that while I'll gladly accept a PR, I don't really want to work on it myself due to lack of time