仍在努力使学说在我的系统上正常工作。我有一个描述我的数据库和表结构的 yaml 文件。(我正在关注zendcast 上的教程)。我的学说脚本文件为
#!/usr/bin/env php
<?php
chdir(dirname(__FILE__));
include('doctrine.php');
并且教义.php 文件包含
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/..'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->getBootstrap()->bootstrap('doctrine');
$config = $application->getOption('doctrine');
$cli = new Doctrine_Cli($config);
$cli->run($_SERVER['argv']);
我的 application.ini 摘录是
autoloaderNamespaces[] = "Doctrine_"
;--
;Database
;--
doctrine.dsn = "mysql://root:softna@localhost/gepm2"
doctrine.data_fixtures_path = APPLICATION_PATH "/configs/data/fixtures"
doctrine.sql_path = APPLICATION_PATH "/configs/data/sql"
doctrine.migrations_path = APPLICATION_PATH "/configs/migrations"
doctrine.yaml_schema_path = APPLICATION_PATH "/configs/schema.yml"
doctrine.models_path = APPLICATION_PATH "/../library/Gepm/Model"
当我运行时:
D:\www\gepm2\application\scripts>php doctrine build-all-reload
我得到了 ff 反馈:
D:\www\gepm2\application\scripts>php doctrine 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 - Successfully created database for connection named 'doctrine'
build-all-reload - Created tables successfully
build-all-reload - Data was successfully loaded
但是,当我检查 mysql 时,只创建了数据库,没有生成表。我已经为此苦苦挣扎了一整天。有人帮忙。
编辑
好吧,我现在开始工作了。但老实说,我对代码所做的唯一更改是 1. 设置时区,
2. 删除 utoloaderNamespaces[] 值末尾的下划线,因此 utoloaderNamespaces[] = "Doctrine_" 变为 autoloaderNamespaces[] = "Doctrine" 和 3. 将原则数据库声明移动到 applications.ini 中 [production] 部分的底部
我的工作进度远远落后于计划,以至于我无法通过这些更改来查看哪些更改或为什么会起作用。等我有空的时候我会说。与此同时,知识渊博的极客可能能够解释为什么它可能有效。干杯。