So I'm currently developing a little project using Propel ORM (v2.00-dev), and I figured I'd try using Vagrant for the first time.
I've set up the vagrant server to allow external MySQL connections, and built the following config file, so I don't have to ssh into the server every time I want to run propel from the command line
{
"propel": {
"paths": {
"outputDir": "./propel/",
"phpDir": "./propel/model/",
"sqlDir": "./propel/sql",
"phpConfDir": "./propel/conf"
},
"database": {
"connections": {
"project-local": {
"adapter": "mysql",
"dsn": "mysql:host=localhost;dbname=scotchbox",
"user": "root",
"password": "root",
"attributes": []
},
"project-remote": {
"adapter": "mysql",
"dsn": "mysql:host=192.168.33.10;dbname=scotchbox",
"user": "root",
"password": "root",
"attributes": []
}
}
},
"runtime": {
"defaultConnection": "project-local",
"connections": ["projeect-local","project-remote"]
},
"generator": {
"defaultConnection": "project-remote",
"connections": ["project-remote","project-local"]
}
}
}
paired with a schema.xml
like:
<database name="project-remote">
<!-- lots of tables in here -->
</database>
Now this has been working great so far. The application runs using project-local
, and when I run propel from the command line it switches to project-remote
as expected.
When I try and run propel diff
however, I get the following error:
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
This suggests that when running diffs, Propel is trying to use the runtime
connection settings rather than the generator
ones. Is there a way I can change this? I've checked the configuration docs, and I cant see anything about setting a connection.
I've also noticed that the diff
command has a --connection
argument, but I can't find any info on it, nor can I work out how to use it. I've tried:
propel diff --connection=project-remote
and
propel diff --connection="project-remote"
Both of which result in the following error
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
The path "propel.database.connections..adapter" cannot contain an empty value, but got "".
So, does anyone have any ideas on how to specify a connection for propel diff (and probably migrate)?