I'm doing the Doctrine integration in Codeigniter but I'm having trouble configuring the command line.
First of all it is worth mentioning that I followed the Doctrine page.
In order to install the dependencies correctly, I used Composer. In this way the structure of the project is organized as follows:
/application
--Libraries <---- Doctrine.php encontra-se aqui
/vendor <---- aqui encontram-se as libs instaladas para o doctrine
/system
index.php <---- essas libs são carregadas no root do projecto
...
In the codeigniter settings file I added Lib "Doctrine" to autoload. So far so good! If booting the application in the browser works fine.
The problem is at the time of setting up the doctrine command line, which among many features allows you to generate the models automated from the database.
According to the tutorial, just create a .php file called cli-config.php
As far as I can see, this file should be placed in one of these directories.
array(2) {
[0]=>
string(52) "/Applications/MAMP/htdocs/Project/main/app"
[1]=>
string(59) "/Applications/MAMP/htdocs/Project/main/app/config"
}
If I browse through the "windows explorer" or mac finder to the vendor / bin folder and open the command line file name doctrine an error appears saying:
You are missing a "cli-config.php" or "config/cli-config.php" file in your
project, which is required to get the Doctrine Console working. You can use the
following sample as a template:
<?php
use Doctrine\ORM\Tools\Console\ConsoleRunner;
// replace with file to your own project bootstrap
require_once 'bootstrap.php';
// replace with mechanism to retrieve EntityManager in your app
$entityManager = GetEntityManager();
return ConsoleRunner::createHelperSet($entityManager);
Soon I have a question! What do they mean by:
// replace with file to your own project bootstrap
require_once 'bootstrap.php';
Assuming that here I should reference the index.php (central file of my codeigniter project) I created a project root file called cli-config.php as it should be done (according to the error message).
All OK. I went to the command line and navigated to the root of my codeigniter project Using composer methods (PHP) I typed.
php vendor / bin / doctrine the output of an error message.
...
<body>
<div id="container">
<h1>A Database Error Occurred</h1>
<p>Unable to connect to your database server using the provided settings.</p><p>Filename: core/Loader.php</p><p>Line Number: 346</p> </div>
</body>
Can anyone help me? I think I figured wrong what they intended with "replace with file to your own project bootstrap" in the tutorial.