Ticket #911 (closed enhancement: fixed)

Opened 3 months ago

Last modified 3 months ago

prado-cli: Better error message if database connection fails when generating Active Record skeletons

Reported by: eirikhm Owned by: knut
Priority: normal Milestone: 3.1.3
Component: Prado Framework v3 Version: 3.1
Severity: trivial Keywords:
Cc:

Description

I have a fresh application generated with prado-cli -c, and a simple database set up. ActiveRecord? is configured as follows:

<module class="System.Data.ActiveRecord?.TActiveRecordConfig" ConnectionID="db1" EnableCache?="true"/>

<module class="System.Data.TDataSourceConfig" id="db1">

<database ConnectionString?="mysql:host=localhost;dbname=mydatabase" Username="root" Password="" />

</module>

When I execute the following:

php /var/www/libs/framework/prado-cli.php generate zipcodes Application.data.ZipcodeRecord?

I get:

Command line tools for Prado 3.1.3a. ** Loaded PRADO appplication in directory "protected".

Fatal error: Call to a member function getConnectionString() on a non-object in /var/www/libs/framework/Data/ActiveRecord/TActiveRecordGateway.php on line 92

Change History

Changed 3 months ago by eirikhm

My bad, I had defined the active record module before the datasource.

Suggestion: Improve error detection here.

Changed 3 months ago by knut

  • owner changed from xue to knut
  • status changed from new to assigned

Changed 3 months ago by knut

  • status changed from assigned to closed
  • type changed from defect to enhancement
  • resolution set to fixed
  • severity changed from crash to trivial
  • summary changed from Prado-cli: Active record generation broken in 3.1.3a (TActiveRecordGateway) to prado-cli: Better error message if database connection fails when generating Active Record skeletons

Thanks for finding. Error message is improved in [2498].

Note: See TracTickets for help on using tickets.