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 1080501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:02:39+00:00 2026-05-16T22:02:39+00:00

I am trying to make Doctrine generate SQL from a set of models that

  • 0

I am trying to make Doctrine generate SQL from a set of models that I created earlier with a YAML schema. Using the code below which comes from the manual the output should be a set of queries.

<?php
// test.php
require_once('bootstrap.php');

try 
{
    $models = Doctrine_Core::generateSqlFromModels('models/generated');

    echo '<pre>';
    var_dump($models);
    echo '</pre>';
}
catch(Exception $e)
{
    echo $e->getMessage();
}

However, the result of this code is:

NULL

while it should return a string with the SQL queries, as said before.

I’ve also tried the following:

<?php
// test.php
require_once('bootstrap.php');

try {
    $result = Doctrine_Core::createTablesFromModels('models/generated');

    echo '<pre>';
    var_dump($result);
    echo '</pre>';
}
catch(Exception $e)
{
    echo $e->getMessage();
}

but that also returns:

NULL

I was not able to find the solution in the manual, the API reference or in the Doctrine core files. I hope someone here knows.

Thanks in advance.

Update: It can not be because of this (old?) bug, because I have no table name that starts with A or B.

Update: My bootstrap.php looks like this:

/**
 * 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();
$conn = Doctrine_Manager::connection('pgsql://user:pass@localhost/dbname', 'doctrine');

$manager->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL);
$manager->setAttribute(Doctrine_Core::ATTR_EXPORT, Doctrine_Core::EXPORT_ALL);
$manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);

Update: I’ve changed the line:

$manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);

to:

$manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_AGGRESSIVE);

but the output of

print_r(Doctrine_Core::filterInvalidModels(Doctrine_Core::loadModels('models/generated'))) 

is still an empty array.

  • 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-16T22:02:39+00:00Added an answer on May 16, 2026 at 10:02 pm

    The problem was that the generated model names were like this:

    <?php
    abstract class BaseClass extends Doctrine_Record
    {
    
    }
    

    Removing the abstract keyword did the trick. All the other Doctrine models are not using the abstract keyword, so it won’t do any harm to remove it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a make generic select control that I can dynamically add elements
Trying to make a MySQL-based application support MS SQL, I ran into the following
Trying to make a generic PL/SQL procedure to export data in specific XML format,
I'm trying to make a context menu for a control that is linked to
I am trying to make a div, that when you click it turns into
I am trying to make a JTable that has column spans available. Specifically, I
I am trying to make an Outlook 2003 add-in using Visual Studio 2008 on
im trying make one replace in string from a array but this dont work
The decision I'm trying to make is where I want to do schema changes.
I'm trying make a <dl> to define the icons I am using on the

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.