I’m trying to add Doctrine to Codeigniter 3 but I can’t make it work.
I downloaded Doctrine from Github(including, Common and DBAL), and put them in a folder Doctrine inside application/libraries. In application/libraries I made a file Doctrine.php with this content.
If I vardump $this->doctrine->em; in the controller it outputs, I don’t, but seems to be loaded.
I made two directories inside models, proxies and entities. Created a file(entity)inside entities with an entity from Doctrine documentation (here).
For the CLI commands I created a file inside application, cli-config.php, but it doesn’t work.
<?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);
What should I do from this point? How do I load the entities?
Thank you.
But how should I load the entity? Or is automatically loaded?
In cli-config.php it says to add the path to the bootstrap.php, but I can’t find the file, it also says to replace with mechanism to retrieve EntityManager in your app, what does that mean?
Thank you.
log
INFO - 2018-07-08 09:03:31 --> Config Class Initialized
INFO - 2018-07-08 09:03:31 --> Hooks Class Initialized
DEBUG - 2018-07-08 09:03:32 --> UTF-8 Support Enabled
INFO - 2018-07-08 09:03:32 --> Utf8 Class Initialized
INFO - 2018-07-08 09:03:32 --> URI Class Initialized
DEBUG - 2018-07-08 09:03:32 --> No URI present. Default controller set.
INFO - 2018-07-08 09:03:32 --> Router Class Initialized
INFO - 2018-07-08 09:03:32 --> Output Class Initialized
INFO - 2018-07-08 09:03:32 --> Security Class Initialized
DEBUG - 2018-07-08 09:03:32 --> Global POST, GET and COOKIE data sanitized
INFO - 2018-07-08 09:03:32 --> Input Class Initialized
INFO - 2018-07-08 09:03:32 --> Language Class Initialized
INFO - 2018-07-08 09:03:32 --> Loader Class Initialized
INFO - 2018-07-08 09:03:37 --> Controller Class Initialized
INFO - 2018-07-08 09:03:37 --> File loaded: C:\Apache24\htdocs\myproject\application\views\templates/header.php
INFO - 2018-07-08 09:03:38 --> Helper loaded: url_helper
INFO - 2018-07-08 09:03:38 --> File loaded: C:\Apache24\htdocs\myproject\application\views\pages/home.php
INFO - 2018-07-08 09:03:38 --> File loaded: C:\Apache24\htdocs\myproject\application\views\templates/footer.php
INFO - 2018-07-08 09:03:38 --> Final output sent to browser
DEBUG - 2018-07-08 09:03:38 --> Total execution time: 6.8284
INFO - 2018-07-08 09:03:44 --> Config Class Initialized
INFO - 2018-07-08 09:03:44 --> Hooks Class Initialized
DEBUG - 2018-07-08 09:03:44 --> UTF-8 Support Enabled
INFO - 2018-07-08 09:03:44 --> Utf8 Class Initialized
INFO - 2018-07-08 09:03:44 --> URI Class Initialized
INFO - 2018-07-08 09:03:44 --> Router Class Initialized
INFO - 2018-07-08 09:03:44 --> Output Class Initialized
INFO - 2018-07-08 09:03:44 --> Security Class Initialized
DEBUG - 2018-07-08 09:03:44 --> Global POST, GET and COOKIE data sanitized
INFO - 2018-07-08 09:03:44 --> Input Class Initialized
INFO - 2018-07-08 09:03:44 --> Language Class Initialized
INFO - 2018-07-08 09:03:44 --> Loader Class Initialized
INFO - 2018-07-08 09:03:45 --> Controller Class Initialized
INFO - 2018-07-08 09:03:45 --> Final output sent to browser
DEBUG - 2018-07-08 09:03:45 --> Total execution time: 0.4657