Welcome Guest, Not a member yet? Register   Sign In
Integration doctrine to codeigniter 4
#1

I have installed doctrine with composer and added Doctrine.php to libraries using tutorial on next link
codeigniter and doctrine

and I try this:


PHP Code:
<?php namespace App\Controllers;

use 
CodeIgniter\Controller;
use 
App\Libraries\Doctrine;

use 
Doctrine\ORM\Query\ResultSetMapping;
use 
Doctrine\ORM\EntityManager;
use 
Doctrine\ORM\Tools\Setup;

class 
Home extends Controller {

public function 
test {

            
$rsm = new ResultSetMapping();
 
           
            
            $query 
$entityManager->createNativeQuery('SELECT * FROM test'$rsm);
 
           
            
            $users 
$query->getResult();
 
           print_r($users);

       }



Autoload


PHP Code:
public $classmap = [
 
           'Test' => APPPATH 'libraries/Test.php',
 
           'Twig' => APPPATH 'libraries/Twig.php',
 
           'Doctrine' => APPPATH 'libraries/Doctrine.php',
 
       ]; 


and I get error: Undefined variable: entityManager

This is only the test for me.
Reply


Messages In This Thread
Integration doctrine to codeigniter 4 - by maky - 06-09-2018, 12:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB