propelorm / Propel2

Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP
http://propelorm.org/
MIT License
1.26k stars 398 forks source link

Newbie Installation Problem #1900

Closed hatwat closed 1 year ago

hatwat commented 2 years ago

Followed all instructions in setting up a propel project. after, installation I created a test php script with the following code:

<?php // setup the autoloading require_once $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';

// setup Propel require_once $_SERVER['DOCUMENT_ROOT'] . '/generated-conf/config.php';

$q = new BarangayQuery(); $barangay = $q->findPK(1);

echo $barangay->barangay;

It's giving me a database is missing error.

Fatal error: Uncaught PDOException: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected in C:\laragon\www\obo_orm\vendor\propel\propel\src\Propel\Runtime\Connection\PdoConnection.php:183 Stack trace: #0 C:\laragon\www\obo_orm\vendor\propel\propel\src\Propel\Runtime\Connection\PdoConnection.php(183): PDO->prepare('SELECT id, bara...', Array) #1 C:\laragon\www\obo_orm\vendor\propel\propel\src\Propel\Runtime\Connection\StatementWrapper.php(81): Propel\Runtime\Connection\PdoConnection->prepare('SELECT id, bara...', Array) #2 C:\laragon\www\obo_orm\vendor\propel\propel\src\Propel\Runtime\Connection\ConnectionWrapper.php(394): Propel\Runtime\Connection\StatementWrapper->prepare(Array) #3 C:\laragon\www\obo_orm\generated-classes\Base\BarangayQuery.php(155): Propel\Runtime\Connection\ConnectionWrapper->prepare('SELECT id, bara...') #4 C:\laragon\www\obo_orm\generated-classes\Base\BarangayQuery.php(137): Base\BarangayQuery->findPkSimple(1, Object(Propel\Runtime\Connection\ConnectionWrapper)) #5 C:\laragon\www\obo_orm\ in C:\laragon\www\obo_orm\generated-classes\Base\BarangayQuery.php on line 160

Any assistance will be highly appreciated. Thank you very much in advance.

DarkAxi0m commented 2 years ago

have you included the config.php file? Can you copy in your test.php script?

hatwat commented 2 years ago

Thanks for the reply. Here's the test script.

<?php // setup the autoloading require_once $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';

// setup Propel require_once $_SERVER['DOCUMENT_ROOT'] . '/generated-conf/config.php';

$q = new BarangayQuery(); $barangay = $q->findPK(1);

echo $barangay->barangay;

On Sun, Aug 7, 2022 at 9:06 PM Christopher Chase @.***> wrote:

have you included the config.php file? Can you copy in your test.php script?

— Reply to this email directly, view it on GitHub https://github.com/propelorm/Propel2/issues/1900#issuecomment-1207404732, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2MJB6TR7KFKXFOARKJYTPDVX6YFVANCNFSM55VHNOGA . You are receiving this because you authored the thread.Message ID: @.***>

hatwat commented 2 years ago

have you included the config.php file? Can you copy in your test.php script?

would appreciatre if you can let me know any misconfiguration in my test script. Thanks in advance.

dereuromark commented 1 year ago

https://github.com/propelorm/propelorm.github.com/pull/427 should probably easy things here