Propel Model: Build Doesn't Answer
I am running Mac OSX Mavericks and I am trying to get Propel up and running. I did a Composer install. For some reason, it gives no response when I run the model: build command.
When I don't have propel.php in the folder:
MacBook-Pro-van-Casper-4: test casper $. / Vendor / bin / propel model: build
[Symfony \ Component \ Config \ Definition \ Exception \ InvalidConfigurationException] The
verbose "database" node in the "propel" path needs to be configured.
So, I made a propel.php file and then didn't get any more response:
MacBook-Pro-van-Casper-4: test casper $. / Vendor / bin / propel model: build
MacBook-Pro-van-Casper-4: test casper $
The fact that I get an error when the propel.php file is missing tells me that Propel is installed just fine.
I get that this is a tricky situation to work with as there is no error, but all suggestions are appreciated.
source to share
The propel.php file should be filled with connection information. See below for example:
<?php
return [
'propel' => [
'database' => [
'connections' => [
'bookstore' => [
'adapter' => 'mysql',
'classname' => 'Propel\Runtime\Connection\ConnectionWrapper',
'dsn' => 'mysql:host=localhost:3306;dbname=bookstore',
'user' => 'root',
'password' => '12345678',
'attributes' => []
],
'wordpress' => [
'adapter' => 'mysql',
'classname' => 'Propel\Runtime\Connection\ConnectionWrapper',
'dsn' => 'mysql:host=localhost:3306;dbname=wordpress',
'user' => 'root',
'password' => '12345678',
'attributes' => []
]
]
],
'runtime' => [
'defaultConnection' => 'bookstore',
'connections' => ['bookstore', 'wordpress']
],
'generator' => [
'defaultConnection' => 'bookstore',
'connections' => ['bookstore','wordpress']
]
]
];
Please note that I have created 2 connections. You can create as many as you like. Now, if you have a schema file, put it at the same level as the propel.php file. I put both at the root of the project and at the same level as the directory vendor
. Create a directory model
at the same level. Then run the following command:
~/Desktop/Propel_orm/vendor/bin/propel model:build --output-dir ~/Desktop/Propel_orm/models
You will have the generated model files in the directory models
. I created a sample project on my desktop. Modify the path accordingly.
source to share
If you haven't trimmed your setup steps, you are missing a few. The answer to your question is shortly: "The schema file is empty"
Propel has a verbosity option for the cli. Very helpful
The propel.php file is the database configuration file. It does not give information about the STRUCTURE database database, only connection data.
What you need to do is rebuild the existing database into a schema. Then clean up your circuit for the good. Then create your models.
The site has great documentation and the rest is what you are missing if you have Existing Databases or if you have New Database
source to share