It would work the same way as "doctrine:schema:create --dump-sql" by printing sql instead of applying it to the database.
I don't think this is possible as doctrine:fixtures:load does not deal with SQL but works at the ORM level.
Agree ;) ! +1
Why ? You could simple load your fixtures in the database and then dump the database to an sql file.
yes, we can do that, but would be nice to have that feature in fixtures, because sometimes you just need to see what its going to write into the database
As @stof said, the bundle deal with the ORM and not raw SQL, maybe something can be done before the flush, just sync the unit of work and instead of push it to the db, writing it down to stdout
i am writing a deployment tool for deploying our software. the tool shouldn´t do all the db stuff on its own, we want to do this manually after the installation is complete. for this it would be nice when the fixtures command will dump the sqls like the schema:update command.
This might be difficult to implement, but if possible I would like it.
I'm trying to build an application to run in Docker. For the MySQL container, I want to be able to generate the SQL scripts for updating the schema and loading the fixtures. The SQL files can then be ADDed into the container and run at build time, so that a Docker image exists such as mycompany/myapp-mysql. When running a container based on that image, the schema and fixtures are already in place.
Apologies that the above is very Docker-specific. Another way to say it is, I want to be able to create the MySQL schema using a copy of the Symfony application, even if that application isn't connected to MySQL at the time.
It works for the schema:
php app/console doctrine:schema:create --dump-sql
(this command doesn't even notice if the DB doesn't exist, I get the SQL anyway)
There seems to be no equivalent with doctrine:fixtures:load. Probably if implemented, it will only work for simple code bases anyway - if your fixtures classes make reference to what they've already loaded, use last insert id etc, then I can't see how it can work.
So, "nice to have", but would be limited anyway.
For my use case above, I'll need to achieve this some other way. Any ideas?
This would require a massive refactoring, possibly replacing the underlying connections by some dummy ones. It would also require to deal with corner cases around flushing/transactions. If this is really wanted, create an issue in https://github.com/doctrine/data-fixtures/ and will set the milestone to 2.0