• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Doctrine integration

#5
(11-17-2019, 04:50 AM)InsiteFX Wrote: Did you read the documentation?

You need to create an instance of the Entity Manager before you can use it.
Here was the problem i didn't create the instance...

I added the namespace for my Doctrine.php in libraries

PHP Code:
<?php
namespace App\Libraries;

include_once 
dirname(__DIR__2) . '/vendor/autoload.php'

Thank you MGatner ! I didn't saw this way to load a library
PHP Code:
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
    {
        
// Do Not Edit This Line
        
parent::initController($request$response$logger);

        
//--------------------------------------------------------------------
        // Preload any models, libraries, etc, here.
        //--------------------------------------------------------------------
        // E.g.:
        // $this->session = \Config\Services::session();

        
$doctrine = new \App\Libraries\Doctrine;
        
$em $doctrine->em;

        
$test $em->getRepository('Entities\DebugTable')->findAll();
        
var_dump($test);
    } 
I'm getting back the data so it's perfect. Big Grin 


Last question my Home controller extend from this BaseController. 
So how i can get my back my $em object in my controllers from this initController?
Reply


Messages In This Thread
Doctrine integration - by ScientiFist - 11-16-2019, 08:26 PM
RE: Doctrine integration - by MGatner - 11-17-2019, 04:39 AM
RE: Doctrine integration - by InsiteFX - 11-17-2019, 04:50 AM
RE: Doctrine integration - by ScientiFist - 11-17-2019, 05:58 PM
RE: Doctrine integration - by MGatner - 11-17-2019, 05:10 AM
RE: Doctrine integration - by MGatner - 11-18-2019, 05:31 AM
RE: Doctrine integration - by ScientiFist - 11-18-2019, 10:34 AM
RE: Doctrine integration - by jasonzig - 11-29-2019, 08:20 AM
RE: Doctrine integration - by MGatner - 11-18-2019, 04:24 PM
RE: Doctrine integration - by ScientiFist - 11-26-2019, 06:29 PM
RE: Doctrine integration - by ScientiFist - 11-30-2019, 07:25 AM
RE: Doctrine integration - by MGatner - 12-01-2019, 05:36 AM
RE: Doctrine integration - by troturier - 12-06-2019, 06:28 AM
RE: Doctrine integration - by ScientiFist - 03-17-2020, 07:06 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.