Zend framework 原则1.2不从Zend框架中的模型创建表

Zend framework 原则1.2不从Zend框架中的模型创建表,zend-framework,doctrine-1.2,Zend Framework,Doctrine 1.2,我正在尝试使用以下方法从模型创建表: Doctrine::createTablesFromModels(APPLICATION_PATH . '/models'); 与从Yaml文件生成模型(工作正常)不同,这根本不起任何作用。没有错误,没有警告,什么都没有。未创建表。如果我运行下面的代码,它也可以正常工作: Doctrine::dropDatabases(); 因此,数据库连接确实有效,权限设置正确。我用谷歌搜索了十种不同的方式,但没有得到任何有用的答案,所以现在我在这里提问 下面是我的一

我正在尝试使用以下方法从模型创建表:

Doctrine::createTablesFromModels(APPLICATION_PATH . '/models');
与从Yaml文件生成模型(工作正常)不同,这根本不起任何作用。没有错误,没有警告,什么都没有。未创建表。如果我运行下面的代码,它也可以正常工作:

Doctrine::dropDatabases();
因此,数据库连接确实有效,权限设置正确。我用谷歌搜索了十种不同的方式,但没有得到任何有用的答案,所以现在我在这里提问

下面是我的一个基类:

<?php

/**
 * BaseUser
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property string $email
 * @property string $password
 * @property string $firstName
 * @property string $lastName
 * @property string $profileText
 * @property integer $role_id
 * @property Role $Role
 * @property Doctrine_Collection $UserDetail
 * @property Doctrine_Collection $CalendarItem
 * @property Doctrine_Collection $NewsItem
 * @property Doctrine_Collection $Link
 * @property Doctrine_Collection $TwitterUser
 * @property Doctrine_Collection $Tweet
 * 
 * @package    ##PACKAGE##
 * @subpackage ##SUBPACKAGE##
 * @author     ##NAME## <##EMAIL##>
 * @version    SVN: $Id: Builder.php 6820 2009-11-30 17:27:49Z jwage $
 */
abstract class BaseUser extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('user');
        $this->hasColumn('email', 'string', 255, array(
             'type' => 'string',
             'length' => '255',
             ));
        $this->hasColumn('password', 'string', 255, array(
             'type' => 'string',
             'length' => '255',
             ));
        $this->hasColumn('firstName', 'string', 255, array(
             'type' => 'string',
             'length' => '255',
             ));
        $this->hasColumn('lastName', 'string', 255, array(
             'type' => 'string',
             'length' => '255',
             ));
        $this->hasColumn('profileText', 'string', null, array(
             'type' => 'string',
             'length' => '',
             ));
        $this->hasColumn('role_id', 'integer', 8, array(
             'type' => 'integer',
             'length' => 8,
             ));

        $this->option('collate', 'utf8_unicode_ci');
        $this->option('charset', 'utf8');
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasOne('Role', array(
             'local' => 'role_id',
             'foreign' => 'id'));

        $this->hasMany('UserDetail', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('CalendarItem', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('NewsItem', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('Link', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('TwitterUser', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('Tweet', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $timestampable0 = new Doctrine_Template_Timestampable();
        $softdelete0 = new softDelete();
        $this->actAs($timestampable0);
        $this->actAs($softdelete0);
    }
}

在此之前,我曾面临过这个问题,经过3天的搜索,我找不到解决方案

最后,我使用symfonycli工具从yaml文件生成sql和创建db,问题已经解决了。我正在使用softdelete功能,但忘记设置:

$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
这是softdelete工作所必需的。我还发现,在我生成的模型中,它使用了错误的软删除代码:

$softdelete0 = new softDelete();
而不是:

$softdelete0 = new Doctrine_Template_SoftDelete();

我们可以看看你的模型+基类吗?我添加了一个基类。我没有更改模型,所以它们只是扩展基类的空类。我当然可以手工制作表,但这只是一种解决方法,我真的希望普通代码能够正常工作。这不是问题的答案,而是一种解决假定的直截了当问题的方法。诚然,你还不能给出问题的完整答案,因为OP还没有发布有用的信息,但我不会那么快提供一种完全不同的方法来处理表生成。这只是为了节省时间,完成工作的变通方法,如果你能提供一个答案,我很乐意使用itAgain,如果不先看一下您的模型和基本类,这是相当困难的。我理解,我愿意看到您修复它。我没有使用Symfony,所以我不能使用cli工具。