好了,我有一個文件夾層次Doctrine.php文件像這樣:學說2.0 Bootstrap?
\ includes\ Setup.php Doctrine\ Common\ DBAL\ ORM\ Symfony\ Doctrine.php
我setup.php有以下幾點:
$rootPath = $_SERVER['DOCUMENT_ROOT'];
$includePath = getcwd() . "\includes";
ini_set('include_path', '.'.PATH_SEPARATOR.$rootPath.PATH_SEPARATOR.$includePath);
require_once 'includes\Doctrine\Doctrine.php';
我Doctrine.php是:
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
require_once 'Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
$classLoader->register();
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$helperSet = null;
if (file_exists($configFile)) {
if (! is_readable($configFile)) {
trigger_error(
'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
);
}
require $configFile;
foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
$helperSet = $helperSetCandidate;
break;
}
}
}
$helperSet = ($helperSet) ?: new \Symfony\Component\Console\Helper\HelperSet();
\Doctrine\ORM\Tools\Console\ConsoleRunner::run($helperSet);
現在,當我包括來自世界你好頁我setup.php,我得到以下警告:
Notice: Undefined index: argv in C:\xampp\htdocs\SpaceWars\includes\Doctrine\Symfony\Component\Console\Input\ArgvInput.php on line 53 Warning: array_shift() expects parameter 1 to be array, null given in C:\xampp\htdocs\SpaceWars\includes\Doctrine\Symfony\Component\Console\Input\ArgvInput.php on line 57
任何人都可以請指導我我做錯了什麼?我試着用谷歌搜索的警告,但似乎無法找到任何東西。
你嘗試使用[沙盒(HTTPS ://github.com/doctrine/doctrine2/tree/master/tools/sandbox)例子? – meze 2011-03-26 18:53:09
如果我完全誠實,對於如何/在哪裏放置Doctrine項目以及如何包含它並將其引導到我的應用程序中,我完全感到困惑。我什至不能在文件中找到告訴我如何去做的事情。 – 2011-03-26 18:56:51
你應該發佈你的Doctrine.php文件。它需要根據您的環境進行定製。 – rojoca 2011-03-26 19:00:57