Hello Everyone!
I'm pretty new to Prado, so sorry if I'm missing something incredibly obvious. I'm working on the Prada Blog Tutorial, and in particular, working on getting the Active Record portion of things working. I've created my database/tables, made sure I can login with the credentials I provide in the applications.xml file and configured my application.xml file as follows:
<?xml version="1.0" encoding="utf-8"?>
<application id="blog" mode="Debug">
<paths>
<using namespace="Application.database.*" />
</paths>
<!-- configurations for modules -->
<modules>
<module id="db" class="System.Data.TDataSourceConfig">
<database ConnectionString="mysql:host=localhost:3306;dbname=website" Username="my_actual_username" Password="my_actual_pw" />
</module>
<module class="System.Data.ActiveRecord.TActiveRecordConfig" ConnectionID="db" />
</modules>
<!-- configuration for available services -->
<services>
<service id="page" class="TPageService" DefaultPage="Home">
<pages MasterClass="Application.layout.MainLayout"/>
</service>
</services>
</application>
Attempting to generate the Active Record classes (UserRecord.php and PostRecord.php) using prado-cli.php, I created the database directory (as per the instructions) and I'm having some kind of connection issue. The error is as follows:
[dswain@peggyo blog]$ php ../prado/framework/prado-cli.php shell .
Command line tools for Prado 3.1.6.
** Loaded PRADO appplication in directory "protected".
PHP-Shell - Version 0.3.1, with readline() support
(c) 2006, Jan Kneschke <jan@kneschke.de>
>> use '?' to open the inline help
>> generate users Application.database.UserRecord
PHP Fatal error: Uncaught exception 'TDbException' with message 'TDbConnection failed to establish DB connection: SQLSTATE[HY000] [2002] Connection refused' in /srv/http/prado/framework/Data/TDbConnection.php:180
Stack trace:
#0 /srv/http/prado/framework/Data/TDbConnection.php(153): TDbConnection->open()
#1 /srv/http/prado/framework/Data/Common/TDbMetaData.php(52): TDbConnection->setActive(true)
#2 /srv/http/prado/framework/Data/ActiveRecord/TActiveRecordGateway.php(113): TDbMetaData::getInstance(Object(TDbConnection))
#3 /srv/http/prado/framework/prado-cli.php(666): TActiveRecordGateway->getTableInfo(Object(TDbConnection), 'users')
#4 /srv/http/prado/framework/prado-cli.php(607): PradoCommandLineActiveRecordGen->generateActiveRecord(Object(TActiveRecordConfig), 'users', '/srv/http/blog/...')
#5 /srv/http/prado/framework/prado-cli.php(761): PradoCommandLineActiveRecordGen->performAction(Array)
#6 /srv/http/prado/framework/3rdParty/PhpShell/PHP/Shell.php(839): PHP_Shell_Extensions_ActiveRecord->generate('generate users ...')
# in /srv/http/prado/framework/Data/TDbConnection.php on line 180
[dswain@peggyo blog]$
I'm assuming that I've just made some kind of mistake with configuring the application.xml file, but I'm not seeing it. I'm using the following websites for my configurations:
http://pradosoft.com/demos/blog-tutorial/?page=Day2.CreateARhttp://pradosoft.com/wiki/index.php/Simple_database_authentication_tutorial_with_Prado_3.1.1Any thoughts? Thanks a bunch!