Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Doctrine CLI problem with create-tables command
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  23 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
jeushy  
View profile   Translate to Translated (View Original)
 More options 26 Oct, 14:48
From: jeushy <jjohn...@grafikchaos.com>
Date: Mon, 26 Oct 2009 07:48:39 -0700 (PDT)
Local: Mon 26 Oct 2009 14:48
Subject: Doctrine CLI problem with create-tables command
When setting up a new application (Zend + Doctrine 1.2) and using the
CLI to generate models from my schema YAML and then create the db
tables I get a message in the CLI that the tables have been created
successfully but checking the database shows that the CLI is lying to
me b/c no tables have been created at all. I can successfully drop,
create and rebuild the db from the CLI, so I know my connection string
is correct. Has anyone else ran into this problem?

# environment
Mac OS X 10.6.1
Zend Framework v 1.9.2
Doctrine 1.2-ALPHA2
PHP 5.2.10

# schema.yml
User:
  tableName: users
  actAs:
    Timestampable:
    Searchable:
        fields: [username]
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    username:
      type: string(60)
      unique: true
    hashed_password:
      type: string(40)
    salt:
      type: string(40)
    first_name:
      type: string(60)
    last_name:
      type: string(60)
    email:
      type: string(60)
      unique: true
    is_active:
      type: integer(1)
    last_login_at:
      type: timestamp(25)

# Zend Framework Bootstrap.php excerpt

    /**
     * _initDoctrine()
     *
     * @author Josh Johnson
     **/
    protected function _initDoctrine()
    {
        require_once APPLICATION_PATH . '/../library/doctrine/
Doctrine.php';
        $loader = Zend_Loader_Autoloader::getInstance();
        $loader->pushAutoloader(array('Doctrine', 'autoload'));

        $doctrineConfig = $this->getOption('doctrine');

        $manager = Doctrine_Manager::getInstance();
        $manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE,
true);
        $manager->setAttribute(
            Doctrine::ATTR_MODEL_LOADING,
            Doctrine::MODEL_LOADING_CONSERVATIVE
        );
        $manager->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES,
true);

        // register the Taggable extension
        $manager->registerExtension('Taggable');

        // Add models and generated base classes to Doctrine
autoloader
        Doctrine::loadModels($doctrineConfig['models_path']);

        $manager->OpenConnection($doctrineConfig['connection_string'],
'zend_app');
        // $manager->OpenConnection($doctrineConfig
['drupal_connection_string'], 'drupal');

    }

Thanks for the help!


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Wage  
View profile   Translate to Translated (View Original)
 More options 26 Oct, 15:33
From: Jonathan Wage <jonw...@gmail.com>
Date: Mon, 26 Oct 2009 11:33:25 -0400
Local: Mon 26 Oct 2009 15:33
Subject: Re: [doctrine-user] Doctrine CLI problem with create-tables command

Make sure you generate your models from the YAML, and then create your
database from your models. Make sure the path to your models is properly
configured.

- Jon

--
Jonathan H. Wage (+1 415 992 5468)
Open Source Software Developer & Evangelist
sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org

You can contact Jonathan about Doctrine, Symfony and Open-Source or for
training, consulting, application development, or business related questions
at jonathan.w...@sensio.com


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
A.J. Brown  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 21:20
From: "A.J. Brown" <a...@ajbrown.org>
Date: Thu, 5 Nov 2009 16:20:58 -0500
Local: Thurs 5 Nov 2009 21:20
Subject: Re: [doctrine-user] Re: Doctrine CLI problem with create-tables command
Im' having the same issue.  All paths are correct, as it creates the
models just fine.  The database will drop and create, but there are no
tables in it.  If I generate-sql, the file is blank.

--
A.J. Brown
web | http://ajbrown.org
phone | (937) 660-3969

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bas Kamer  
View profile   Translate to Translated (View Original)
 More options 6 Nov, 12:40
From: Bas Kamer <b...@bushbaby.nl>
Date: Fri, 6 Nov 2009 13:40:04 +0100
Local: Fri 6 Nov 2009 12:40
Subject: Re: [doctrine-user] Re: Doctrine CLI problem with create-tables command
it appears I have the same/a similar issue

with 1.1.5 the following works

loptap:scripts bas$ ./doctrine.sh rebuild-db
rebuild-db - Are you sure you wish to drop your databases? (y/n)
y
rebuild-db - Successfully dropped database for connection named  
'default'
rebuild-db - Generated models successfully from YAML schema
rebuild-db - Successfully created database for connection named  
'default'
rebuild-db - Created tables successfully

with 1.2.0BETA1 the exact same thing drops and creates the database,  
creates the models, but does not create any tables or an sql file
loptap:scripts bas$ ./doctrine.sh rebuild-db
rebuild-db - Are you sure you wish to drop your databases? (y/n)
y
rebuild-db - Successfully dropped database for connection "default"  
named "parablesdemo"
rebuild-db - Generated models successfully from YAML schema
rebuild-db - Successfully created database for connection "default"  
named "parablesdemo"
rebuild-db - Created tables successfully
loptap:scripts bas$

db stays empty

OSX10.6.1
Doctrine 1.2.*
PHP5.3.0

On 5 nov 2009, at 22:20, A.J. Brown wrote:

bushbaby multimedia ontwerp & uitvoering
b...@bushbaby.nl | +31(0)6 2897 7426

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bas Kamer  
View profile   Translate to Translated (View Original)
 More options 6 Nov, 13:06
From: Bas Kamer <b...@bushbaby.nl>
Date: Fri, 6 Nov 2009 14:06:01 +0100
Local: Fri 6 Nov 2009 13:06
Subject: Re: [doctrine-user] Re: Doctrine CLI problem with create-tables command

On 6 nov 2009, at 13:40, Bas Kamer wrote:

> .... see previous

just wanted to add that with 1.2 the generated files model (meaning  
the Base classes, not the User models) classes cannot be found  
automagically and I need to manually include those models...  
eventhough that path is in the include_path???

with 1.1, I do not need to indclude the files manually...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ajbrown  
View profile   Translate to Translated (View Original)
 More options 7 Nov, 18:13
From: ajbrown <a...@ajbrown.org>
Date: Sat, 7 Nov 2009 10:13:42 -0800 (PST)
Local: Sat 7 Nov 2009 18:13
Subject: Re: Doctrine CLI problem with create-tables command
Does anyone have an suggestions for this?

I still cannot get Doctrine 1.2 to create tables or sql for me.  I've
done this hundreds of times on Doctrine 1.1, though.

On Nov 6, 8:06 am, Bas Kamer <b...@bushbaby.nl> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
A.J. Brown  
View profile   Translate to Translated (View Original)
 More options 7 Nov, 19:40
From: "A.J. Brown" <a...@ajbrown.org>
Date: Sat, 7 Nov 2009 14:40:53 -0500
Local: Sat 7 Nov 2009 19:40
Subject: Re: [doctrine-user] Re: Doctrine CLI problem with create-tables command
I figured out my particular issue.  I'm integrating with Zend
Framework.  When registering the Doctrine Autoloader, you have to set
the Zend_Loader_Autoloader as the fallback autoloader first, and make
sure your based model path is in the include path.

--
A.J. Brown
web | http://ajbrown.org
phone | (937) 660-3969

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
wickeddoc  
View profile   Translate to Translated (View Original)
 More options 9 Nov, 16:49
From: wickeddoc <ythom...@gmail.com>
Date: Mon, 9 Nov 2009 08:49:50 -0800 (PST)
Local: Mon 9 Nov 2009 16:49
Subject: Re: Doctrine CLI problem with create-tables command

i'm still experiencing the same problem, your autoloader work-around
didn't work for me

does anybody else have the same problem, or maybe better, a solution
please?

before upgrading to 1.1 everything worked great, but after the 1.2
update, the generate-migrations-diff and generate-sql commands don't
work anymore :(

generate-sql generates a 0 bytes file and generate-migrations-diff
says: "Could not generate migration classes from difference"

very strange


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
travis  
View profile   Translate to Translated (View Original)
 More options 11 Nov, 01:22
From: travis <arthurdeli...@gmail.com>
Date: Tue, 10 Nov 2009 17:22:18 -0800 (PST)
Local: Wed 11 Nov 2009 01:22
Subject: Re: Doctrine CLI problem with create-tables command
Just wanted to add that I am also having the exact same issue? I'm
gonna go look in the bug reports and see if its been submitted?

On Oct 26, 8:48 am, jeushy <jjohn...@grafikchaos.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dkwad  
View profile   Translate to Translated (View Original)
 More options 11 Nov, 17:30
From: Dkwad <legiond...@googlemail.com>
Date: Wed, 11 Nov 2009 09:30:53 -0800 (PST)
Local: Wed 11 Nov 2009 17:30
Subject: Re: Doctrine CLI problem with create-tables command
I am having the same issue using Doctrine 1.2 and ZF 1.9.5 on Ubuntu,
couldnt see anything on the Doctrine JIRA

On Nov 10, 8:22 pm, travis <arthurdeli...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
dimitris75  
View profile   Translate to Translated (View Original)
 More options 11 Nov, 20:01
From: dimitris75 <dxry...@gmail.com>
Date: Wed, 11 Nov 2009 12:01:18 -0800 (PST)
Local: Wed 11 Nov 2009 20:01
Subject: Re: Doctrine CLI problem with create-tables command
With doctrine 1.2, I can only seem to export tables when model loading
is set to aggressive.
I have doctrine integrated with kohana.

On Nov 11, 7:30 pm, Dkwad <legiond...@googlemail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fabrizio  
View profile   Translate to Translated (View Original)
 More options 11 Nov, 20:37
From: Fabrizio <fabrizio.pucci...@gmail.com>
Date: Wed, 11 Nov 2009 12:37:42 -0800 (PST)
Local: Wed 11 Nov 2009 20:37
Subject: Re: Doctrine CLI problem with create-tables command
With Doctrine 1.2 beta 2 and cli, when I run ./doctrine build.all-
reload

the result is:

build-all-reload - Are you sure you wish to drop your databases? (y/n)
y
build-all-reload - Successfully dropped database for connection named
'connection 1'
build-all-reload - Generated models successfully from YAML schema
build-all-reload - Successfully created database for connection named
'connection 1'
PHP Fatal error:  Class 'BaseTableName' not found in /path/to/model/
model/TableName.php on line 13

Fatal error: Class 'BaseScadenziario' not found in /path/to/model/
TableName.php on line 13


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dkwad  
View profile   Translate to Translated (View Original)
 More options 11 Nov, 22:04
From: Dkwad <legiond...@googlemail.com>
Date: Wed, 11 Nov 2009 14:04:54 -0800 (PST)
Local: Wed 11 Nov 2009 22:04
Subject: Re: Doctrine CLI problem with create-tables command
I just get all created OK,

The models are created, but nothing is in the database.

As mentioned earlier I can delete and create the DB using the cli and
I have checked, rechecked and checked once more that all the paths are
correct.

On Nov 11, 8:37 pm, Fabrizio <fabrizio.pucci...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
dasher  
View profile   Translate to Translated (View Original)
 More options 12 Nov, 00:10
From: dasher <das...@inspiredthinking.co.uk>
Date: Thu, 12 Nov 2009 01:10:53 +0100
Local: Thurs 12 Nov 2009 00:10
Subject: Re: [doctrine-user] Re: Doctrine CLI problem with create-tables command
This usually happens after you change the name of a table in the schema.
The models in base get wiped and generated - but the models in the dir
above no-longer have their baseModel.

iirc clean-model-files fixes it.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dkwad  
View profile   Translate to Translated (View Original)
 More options 12 Nov, 01:32
From: Dkwad <legiond...@googlemail.com>
Date: Wed, 11 Nov 2009 17:32:12 -0800 (PST)
Local: Thurs 12 Nov 2009 01:32
Subject: Re: Doctrine CLI problem with create-tables command
Thaks dasher, but this isnt the problem...

Im following this tut
http://www.danceric.net/2009/10/29/doctrine-1-2-is-zend-framework-fri...

The models are generate fine. I can create and drop the database.
However, the schema.sql file when generated is empty and when I use
create-tables via the CLI nothing is added to the databse. The CLI
runs fine, no errors or warnings.

On 12 Nov, 00:10, dasher <das...@inspiredthinking.co.uk> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jwage  
View profile   Translate to Translated (View Original)
 More options 12 Nov, 18:58
From: jwage <jonw...@gmail.com>
Date: Thu, 12 Nov 2009 10:58:09 -0800 (PST)
Local: Thurs 12 Nov 2009 18:58
Subject: Re: Doctrine CLI problem with create-tables command
If the script you use to create the tables, has already loaded the
models from the disk, then it might not work. Make sure you aren't
loading every single model class. In order for the create-tables
command to work, it must be able to load the models from the disk for
the first time. I suspect your configuration/bootstrap is loading the
models.

- Jon

On Nov 11, 8:32 pm, Dkwad <legiond...@googlemail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fabrizio  
View profile   Translate to Translated (View Original)
 More options 13 Nov, 15:03
From: Fabrizio <fabrizio.pucci...@gmail.com>
Date: Fri, 13 Nov 2009 07:03:58 -0800 (PST)
Local: Fri 13 Nov 2009 15:03
Subject: Re: Doctrine CLI problem with create-tables command
Hi,
the script I use is the follow:

#!/usr/bin/env php
<?php

include('../lib/vendor/doctrine/Doctrine.php');

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

$conn = Doctrine_Manager::connection('mysql://user:password@localhost/
dbname', 'connection 1');
$conn->setCharset("utf8");

$config = array('data_fixtures_path'  =>  dirname(__FILE__).'/../data/
fixtures',
                'models_path'         =>  dirname(__FILE__).'/../lib/
model',
                'migrations_path'     =>  dirname(__FILE__).'/../data/
migrations',
                'sql_path'            =>  dirname(__FILE__).'/../data/
sql',
                'yaml_schema_path'    =>  dirname(__FILE__).'/../
config/doctrine/schema.yml',
                'generateTableClasses'  =>  true
                );

$cli = new Doctrine_Cli($config);

$cli->run($_SERVER['argv']);

?>

And the output when I run this command

./doctrine build-all-reload

is:

build-all-reload - Are you sure you wish to drop your databases? (y/n)
y
build-all-reload - Successfully dropped database for connection named
'connection 1'
build-all-reload - Generated models successfully from YAML schema
build-all-reload - Successfully created database for connection named
'connection 1'
PHP Fatal error:  Class 'BaseTableName' not found in /var/www/html/
project_folder/lib/model/TableName.php on line 13

Fatal error: Class 'BaseTableName' not found in /var/www/html/
project_folder/lib/model/TableName.php on line 13

Where is the problem?
Thanks

Fabrizio

On 12 Nov, 19:58, jwage <jonw...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bas Kamer  
View profile   Translate to Translated (View Original)
 More options 13 Nov, 18:21
From: Bas Kamer <b...@bushbaby.nl>
Date: Fri, 13 Nov 2009 19:21:39 +0100
Local: Fri 13 Nov 2009 18:21
Subject: Re: [doctrine-user] Re: Doctrine CLI problem with create-tables command
You need to add the path of the models
To your include_path

Bas

On 13-nov-2009, at 16:03, Fabrizio <fabrizio.pucci...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Mancini  
View profile   Translate to Translated (View Original)
 More options 14 Nov, 21:54
From: Alex Mancini <nmanc...@gmail.com>
Date: Sat, 14 Nov 2009 13:54:56 -0800 (PST)
Local: Sat 14 Nov 2009 21:54
Subject: Re: Doctrine CLI problem with create-tables command
I ran into this problem recently when upgrading a ZF project to the
Doctrine 1.2 branch.

The solution was to setup the autoloader in the bootstrap like this:

$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->pushAutoloader(array('Doctrine', 'autoload'));
spl_autoload_register(array('Doctrine', 'modelsAutoload'));

Cheers,
Alex

On Nov 11, 6:32 pm, Dkwad <legiond...@googlemail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Silbiger  
View profile   Translate to Translated (View Original)
 More options 9 Dec, 22:52
From: Robert Silbiger <silbi...@gmx.net>
Date: Wed, 9 Dec 2009 14:52:04 -0800 (PST)
Local: Wed 9 Dec 2009 22:52
Subject: Re: Doctrine CLI problem with create-tables command
Hi,

well I had the same problem where I had my YAML scheme, had all the
paths setup correctly, yet upon a "build-all-load" from the CLI I, I
got all the PHP models and the database but no tables in the database.

So I spent a couple of hours in debug mode (have to love open source
for this), and it turns out that one of my index definitions in my
YAML schema was acceptable to Doctrine but not to MySQL, and the
script terminated silently once it started to create tables in MySQL.
When I removed the index definition from YAML, all tables were created
beautifully. Apart from an unacceptable column that is, which Doctrine
told me about nicely.

Although, I would have preferred Doctrine to give me a verbose error
message about the index, it was ultimately my syntax that prevented it
from created the tables.

Hope that helps

Windows XP
Doctrine 1.2.1
Zend 1.9.5
MySQL 5.1.37

On Oct 27, 12:48 am, jeushy <jjohn...@grafikchaos.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jeushy  
View profile   Translate to Translated (View Original)
 More options 9 Dec, 23:24
From: jeushy <jjohn...@grafikchaos.com>
Date: Wed, 9 Dec 2009 15:24:42 -0800 (PST)
Local: Wed 9 Dec 2009 23:24
Subject: Re: Doctrine CLI problem with create-tables command
Alex! You just saved me a trip to the hospital and having to patch
another hole in the wall.

I can confirm that the spl_autoload_register(array('Doctrine',
'modelsAutoload')); line worked to fix my woes on a Zend 1.9.6 and
Doctrine 1.2.1 application.

Cheers,
Josh

On Nov 14, 3:54 pm, Alex Mancini <nmanc...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kevin  
View profile   Translate to Translated (View Original)
 More options 10 Dec, 18:10
From: kevin <young.ke...@gmail.com>
Date: Thu, 10 Dec 2009 10:10:05 -0800 (PST)
Local: Thurs 10 Dec 2009 18:10
Subject: Re: Doctrine CLI problem with create-tables command
Hey,

I just found this thread and I am experiencing similar problems
getting the doctrine cli to properly generate zf-compatible models
based on a schema yaml file.

Below are my specific details including an example of the cli output.

Any help would be greatly appreciated.

===
System Information
====
Apache/2.2.11 (Win32)
PHP/5.2.10
Doctrine 1.2.1
ZF 1.9.6

====
End System Information
====

====
Directory Structure
====

mysite/
        application/
                configs/
                        application.ini
                        schema.yml
                modules/
                        default/
                                models/
                scripts/
                        rebuild_models.php
                bootstrap.php

        data/
                doctrine/
                        fixtures/
                        migrations/
                        sql/

        library/
                Zend/
                ZendX/
                Doctrine/
                Doctrine.php

        public/
                .htaccess
                index.php

====
End Directory Structure
====

===
Application Bootstrap (mysite/application/bootstrap.php)
===

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initAppAutoload()
    {
        $autoloader = new Zend_Application_Module_Autoloader(array(
            'namespace' => 'Default',
            'basePath'  => dirname(__FILE__).'/modules/default',
        ));

        $autoloader->addResourceTypes(array(
          'controllerhelper' => array(
                'namespace' => 'Controller_Helper',
                'path'      => 'controllers/helpers',
        )));
        return $autoloader;
    }

    protected function _initDoctrine()
    {
        $this->getApplication()->getAutoloader()
                               ->pushAutoloader(array('Doctrine',
'autoload'));
        spl_autoload_register(array('Doctrine',
'modelsAutoload'));

        $manager = Doctrine_Manager::getInstance();
        $manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE,
true);
        $manager->setAttribute(
            Doctrine::ATTR_MODEL_LOADING,
            Doctrine::MODEL_LOADING_CONSERVATIVE
        );
        $manager->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES,
true);

        $dsn = $this->getOption('dsn');
        $conn = Doctrine_Manager::connection($dsn, 'doctrine');
        $conn->setAttribute(Doctrine::ATTR_USE_NATIVE_ENUM, true);
        return $conn;

    }

}

===
End Application Bootstrap
===

===
Schema File
===

---
User:
  columns:
    id:
      primary: true
      autoincrement: true
      type: integer(4)
    username: string(255)
    password: string(255)
  relations:
    Groups:
      class: Group
      refClass: UserGroup
      foreignAlias: Users

Group:
  tableName: groups
  columns:
    id:
      primary: true
      autoincrement: true
      type: integer(4)
    name: string(255)

UserGroup:
  columns:
    user_id: integer(4)
    group_id: integer(4)
  relations:
    User:
      onDelete: CASCADE
    Group:
      onDelete: CASCADE

===
End Schema File
===

===
rebuild_models.php
===

<?php
define('APPLICATION_PATH', 'D:\Web Server Root\Projects\mysite
\application');

set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '\modules\default\models'),
realpath(APPLICATION_PATH . '/../library'),
)));

require_once('Zend/Loader/Autoloader.php');
Zend_Loader_Autoloader::getInstance();

require_once(APPLICATION_PATH . '/../library/Doctrine.php');

spl_autoload_register(array('Doctrine', 'autoload'));
spl_autoload_register(array('Doctrine', 'modelsAutoload'));

$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
$manager->setAttribute(Doctrine::ATTR_MODEL_LOADING,
Doctrine::MODEL_LOADING_CONSERVATIVE);
$manager->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true);
$manager->setAttribute(Doctrine_Core::ATTR_EXPORT,
Doctrine_Core::EXPORT_ALL);
$manager->setCharset('utf8');
$manager->setCollate('utf8_unicode_ci');

$dsn = "mysql://mysite_user:passw...@mysite.com/mysite_db";

$conn = Doctrine_Manager::connection($dsn, 'doctrine');
$conn->setAttribute(Doctrine::ATTR_USE_NATIVE_ENUM, true);

$config = array(
'data_fixtures_path' => APPLICATION_PATH.'/data/doctrine/fixtures',
'models_path' => APPLICATION_PATH.'/modules/default/models',
'migrations_path' => APPLICATION_PATH.'/data/doctrine/migrations',
'sql_path' => APPLICATION_PATH.'/data/doctrine/sql',
'yaml_schema_path' => APPLICATION_PATH.'/configs',
'generate_models_options' => array(
        'pearStyle' => false,
        'generateTableClasses' => true,
        'generateBaseClasses' => true,
        'classPrefixFiles' => false,
        'baseClassPrefix' => 'Base',
        'classPrefix' => 'Default_Model_',
        'baseClassesDirectory' => null,
        )
);

Doctrine_Core::setModelsDirectory($config['models_path']);

$cli = new Doctrine_Cli($config);
$cli->run($_SERVER['argv']);

===
end rebuild_models.php
===

===
rebuild_models.php output
===
php rebuild_models.php build-all-reload

build-all-reload - Are you sure you wish to drop your databases? (y/n)
y
build-all-reload - Successfully dropped database for connection named
'doctrine'
build-all-reload - Generated models successfully from YAML schema
build-all-reload - Successfully created database for connection named
'doctrine'
build-all-reload - Created tables successfully
PHP Fatal error:  Cannot redeclare class Default_Model_BaseGroup in D:
\Web Server Root\Projects\mysite\application\modules\default\models
\BaseGroup.php on line 47
Fatal error: Cannot redeclare class Default_Model_BaseGroup in D:\Web
Server Root\Projects\mysite\application\modules\default\models
\BaseGroup.php on line 47

===
end rebuild_models.php output
===


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jvega  
View profile   Translate to Translated (View Original)
 More options 17 Dec, 14:57
From: jvega <david.vega.cas...@gmail.com>
Date: Thu, 17 Dec 2009 06:57:04 -0800 (PST)
Local: Thurs 17 Dec 2009 14:57
Subject: Re: Doctrine CLI problem with create-tables command
This is the solution:
move this line $manager->setAttribute(Doctrine::ATTR_MODEL_LOADING,
Doctrine::MODEL_LOADING_CONSERVATIVE);
from the bootstrap file to other file like index.php.

that attribute has issues with doctrine cli-tasks


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google