6
I’m doing the integration of Doctrine in Codeigniter but I’m having problems configuring the line.
First of all it is important to mention that I followed the guide available on the Doctrine website.
To install the dependencies correctly I used Composer. In this way the structure of the project is organised 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 the Lib "Doctrine" in autoload. So far so good! If boot the application in the browser works well.
The problem is time to configure the Doctrine command line that among many features allows generating the "models" in an automated way from the database.
According to the tutorial just create a. php file called cli-config.php
So I was able to verify that 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 navigate through the "windows explorer" or the mac Finder to the vendor/bin folder and open the Doctrine command line file an error arises 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);
Right here I have a question! What do they mean by:
// replace with file to your own project bootstrap
require_once 'bootstrap.php';
Assuming I should reference index.php (the core file of my codeigniter project) I created a file in the project root called cli-config.php as it should be done (according to the error message).
OK. I went to the command line and navigated to the root of my codeigniter project Using the methods of Composer (PHP) typed.
php vendor/bin/Doctrine 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’ve misunderstood what they mean by "replace with file to your Own project bootstrap" in the tutorial.
you have set up some environment variable?
– rray
no, but I don’t think that should be necessary as the php command was installed by Composer and is available. If I do php -help I can see the list of options available
– Lothre1
Vc is trying to configure on mac or windows?
– rray
I am using MAC
– Lothre1