:教義1.2のZend Frameworkでモデルからテーブルを作成しない
Doctrine::createTablesFromModels(APPLICATION_PATH . '/models');
をうまく働いたYAMLファイルからモデルを生成するとは違って、これはでは何もしませんすべて。エラーなし、警告なし、何もありません。テーブルは作成されません。下のコードを実行すると、正常に動作します。
Doctrine::dropDatabases();
したがって、データベース接続は機能し、権限は正しく設定されています。私は10の異なった方法でそれをgoogledしました。何の役に立つ答えも得られなかったので、今私はここで尋ねています。ここで
は私の基底クラスの1つである:私はその前に、この問題に直面し、私はそれの終わりに解決 を見つけることができませんでした検索の3日後に私が使用して移動していたていた
<?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);
}
}
私たちはあなたのモデルの一つ+基底クラスを参照してくださいもらえますか? – adlawson
基本クラスの1つを追加しました。私はモデルを変更していないので、基本クラスを拡張した空のクラスに過ぎません。 –
もちろん、テーブルを手作業で作成することもできますが、それは単なる回避策であり、通常のコードを正常に動作させたいだけです。 –