Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3451756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:10:47+00:00 2026-05-18T09:10:47+00:00

I have been working on the introduction on the link below and have been

  • 0

I have been working on the introduction on the link below and have been able to complete previous steps but when it comes to running the generate.php file I get an error about the dsn. Is there missing steps that was ommited about changing the dsn?
http://www.doctrine-project.org/projects/orm/1.2/docs/manual/introduction-to-models/en#introduction-to-models

-----------------------------------
error output
-----------------------------------
Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'You must create your Doctrine_Connection by using a valid Doctrine style dsn in order to use the create/drop database functionality' in /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Connection.php:1460
Stack trace:
#0 /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Manager.php(707): Doctrine_Connection->dropDatabase()
#1 /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Core.php(972): Doctrine_Manager->dropDatabases(Array)
#2 /Users/sone/sources/doctrine1.2/doctrine_test/generate.php(8): Doctrine_Core::dropDatabases()
#3 {main}
  thrown in /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Connection.php on line 1460
-----------------------------------

Fatal Error with Doctrine while using generate.php

I saw a similar issue (link above) with the generate.php file here but the solution offered and error are slight different and don’t work in my case. Changing the dsn string to
$conn = Doctrine_Manager::connection(‘mysql://sonint99:C2sHF9Zxq3ULXCTV@127.0.0.1/doctrine’); does not work either. I get this error now.

si2:doctrine_test sone$ php generate.php

Fatal error: Uncaught exception 'Doctrine_Manager_Exception' with message 'Unknown connection: doctrine' in /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Manager.php:512
Stack trace:
#0 /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Manager.php(554): Doctrine_Manager->getConnection('doctrine')
#1 /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Export.php(1107): Doctrine_Manager->getConnectionForComponent('Test')
#2 /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Export.php(1205): Doctrine_Export->exportSortedClassesSql(Array)
#3 /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Export.php(1100): Doctrine_Export->exportClasses(Array)
#4 /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Core.php(894): Doctrine_Export->exportSchema('models')
#5 /Users/sone/sources/doctrine1.2/doctrine_test/generate.php(11): Doctrine_Core::createTablesFromModels('models')
#6 {main}
   in /Users/sone/sources/doctrine1.2/doctrine_test/lib/vendor/doctrine/Doctrine/Manager.php on line 512

my boot strap

<?php
// bootstrap.php

/**
 * Bootstrap Doctrine.php, register autoloader specify
 * configuration attributes and load models.
 */

require_once(dirname(__FILE__) . '/lib/vendor/doctrine/Doctrine.php');

// ...
spl_autoload_register(array('Doctrine', 'autoload'));

// ...
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
$manager->setAttribute(Doctrine_Core::ATTR_AUTOLOAD_TABLE_CLASSES, true);

// Setting up DB connection
$dsn = 'mysql:dbname=doctrine;host=127.0.0.1';
$user = 'sonint99';
$password = 'C2sHF9Zxq3ULXCTV';
$dbh = new PDO($dsn, $user, $password);
$conn = Doctrine_Manager::connection($dbh,'doctrine');
Doctrine_Core::loadModels('models');
//$conn = Doctrine_Manager::connection('mysql://sonint99:C2sHF9Zxq3ULXCTV@127.0.0.1/doctrine');


generate.php

<?php


// generate.php

require_once('bootstrap.php');

Doctrine_Core::dropDatabases();
Doctrine_Core::createDatabases();
Doctrine_Core::generateModelsFromYaml('schema.yml', 'models');
Doctrine_Core::createTablesFromModels('models');

schema.yml

Test:
  connection: doctrine
  tableName: test
  columns:
    id:
      type: integer(8)
      autoincrement: true
      primary: true
    name:
      type: string()
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
User:
  connection: doctrine
  tableName: user
  columns:
    id:
      type: integer(8)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
    first_name:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    last_name:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    username:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    password:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    type:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    is_active:
      type: integer(1)
      fixed: false
      unsigned: false
      primary: false
      default: '1'
      notnull: false
      autoincrement: false
    is_super_admin:
      type: integer(1)
      fixed: false
      unsigned: false
      primary: false
      default: '0'
      notnull: false
      autoincrement: false
    created_at:
      type: timestamp(25)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    updated_at:
      type: timestamp(25)
      fixed: false
      unsigned: false
      primary: false
      default: '0000-00-00 00:00:00'
      notnull: true
      autoincrement: false
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:10:48+00:00Added an answer on May 18, 2026 at 9:10 am

    The Docs are rather strange because they mention PDO for the ::connection() method. This method is not even used in the tutorials on the site 😉

    A proper call with the connection could be like

    $db['dsn'] = "mysql://user:password@localhost/database"; //use localhost instead of 127.0.0.1
    $conn = Doctrine_Manager::connection($db['dsn'], 'con_name');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on on an AJAX chat application using php, mysql. It's
I have been working in C# for quite some time but come around this
I have been working on a new menu and I'm almost there, but the
I have been working with this for a whole day but i cannot find
I have been working with relational databases for sometime, but it only recently occurred
I have been working with Struts for some time, but for a project I
Have been working in Ruby for a while, but usually in the context of
I have been working with the google docs api found here: https://developers.google.com/google-apps/documents-list/#introduction This issue
Have been working on this question for a couple hours and have come close
I have been working on Eclipse recently. I am fairly new to java programming,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.