I'm trying to build a project with Propel these days. I did the basic 'bookstore' tutorial on propelorm.org/documentation/02-buildtime.html, but when I'm trying to finally insert the generated sql code via propel, to fill the database, the following error is thrown:
[Exception] Unable to parse contents of "/sqldb.map".
Unfortunately I've got no idea what went wrong; I followed the tutorial as precisely as possible.
Information about my installation and what I've done so far:
1) Localhost installation (Mac OS 10.8.5) with PHP 5.4.27 (DOM Module, PDO and SPL enabled) and MySQL 5.6.19.
2) successfully parsed Composer.json with:
{
"require": {
"propel/propel": "~2.0@dev"
},
"autoload": {
"classmap": ["bookstoreDb/generated-classes/"]
}
}
3) created a schema.xml with foreign keys, exactly like in the tutorial (propelorm.org/documentation/02-buildtime.html).
4) created a config file, propel.yaml, in subfolder 'conf', again like in the tutorial.
5) used the propel scripts to generate the necessary sql (propel sql:build
), model (propel model:build
) and configuration files (propel config:convert
). The result of these commands are as indicated as in the tutorial.
6) created the database 'bookstore' successfully via terminal.
7) trying to insert the sql code via propel sql:insert
. Now the error as described above is thrown:
[Exception] Unable to parse contents of "/sqldb.map".
Here is the index.php of the project:
// setup the autoloading
require_once 'vendor/autoload.php';
// setup Propel
require_once 'bookstoreDb/generated-conf/config.php';
// Here I get the parse error: parse error in ../bookstore/bookstoreDb/generated-classes/Base/Author.php on line 138
$author = new Author();
$author->setFirstName('Jane');
$author->setLastName('Austen');
$author->save();
And here the config.php:
$serviceContainer = \Propel\Runtime\Propel::getServiceContainer();
$serviceContainer->checkVersion('2.0.0-dev');
$serviceContainer->setAdapterClass('bookstore', 'mysql');
$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle();
$manager->setConfiguration(array (
'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper',
'dsn' => 'mysql:host=localhost;dbname=bookstore',
'user' => 'root',
'password' => 'password',
'attributes' =>
array (
'ATTR_EMULATE_PREPARES' => false,
),
));
$manager->setName('bookstore');
$serviceContainer->setConnectionManager('bookstore', $manager);
$serviceContainer->setDefaultDatasource('bookstore');
Where may be the problem? And is there some other way to setup a basic project? I'd appreciate every help! Thanks!