0
votes

I would like to ask if any one of you can help me. History:

  1. Set-Up CodeIgniter
  2. Copy the Library of Doctrine
  3. Create the Doctrine.php
  4. Test the Controller - hello world - ok
  5. Test the Model by saving data into Database - failed

Error : A PHP Error was encountered

Severity : Warning

Message :

require(C:/CI/system/application/libraries/Doctrine/Common/ClassLoader.php\Doctrine\ORM\Configuration.php): failed to open stream: No such file or directory

Filename : Common/ClassLoader.php

Line Number : 164

Fatal error : require(): Failed opening required 'C:/CI/system/application/libraries/Doctrine/Common/ClassLoader.php\Doctrine\ORM\Configuration.php' (include_path='.;C:\php\pear') in C:\CI\system\application\libraries\Doctrine\Common\ClassLoader.php on line 164

Copy of Doctrine.Php

<?php
use Doctrine\Common\ClassLoader,
    Doctrine\ORM\Configuration,
    Doctrine\ORM\EntityManager,
    Doctrine\Common\Cache\ArrayCache,
    Doctrine\DBAL\Logging\EchoSQLLogger;

class Doctrine {

  public $em = null;

  public function __construct()
  {
    // load database configuration from CodeIgniter
    require_once APPPATH.'config/database.php';

    // Set up class loading. You could use different autoloaders, provided by your favorite framework,
    // if you want to.
        require_once APPPATH.'libraries/Doctrine/Common/ClassLoader.php';
 //   require_once APPPATH.'libraries/Doctrine/Common/ClassLoader.php';

    $doctrineClassLoader = new ClassLoader('Doctrine',  APPPATH.'libraries/Doctrine/Common/ClassLoader.php');
    $doctrineClassLoader->register();
    $entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, "/" ));
    $entitiesClassLoader->register();
    $proxiesClassLoader = new ClassLoader('Proxies', APPPATH.'models/proxies');
    $proxiesClassLoader->register();

    // Set up caches
    $config = new Configuration;
    $cache = new ArrayCache;
    $config->setMetadataCacheImpl($cache);
    $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH.'models'));
    $config->setMetadataDriverImpl($driverImpl);
    $config->setQueryCacheImpl($cache);

    $config->setQueryCacheImpl($cache);

    // Proxy configuration
    $config->setProxyDir(APPPATH.'/models/proxies');
    $config->setProxyNamespace('Proxies');

    // Set up logger
    $logger = new EchoSQLLogger;
    $config->setSQLLogger($logger);

    $config->setAutoGenerateProxyClasses( TRUE );

    // Database connection information
    $connectionOptions = array(
        'driver' => 'pdo_mysql',
        'user' =>     $db['default']['root'],
        'password' => $db['default']['root'],
        'host' =>     $db['default']['localhost'],
        'dbname' =>   $db['default']['ci_database']
    );

    // Create EntityManager
    $this->em = EntityManager::create($connectionOptions, $config);
  }
}

-------------------------------------------------------------------------------------------
2

2 Answers

0
votes

May be you miss the load Doctrine files into your system/application/plugin

Refer this

0
votes

you should copy Doctrine folder containing DBAL, Common and ORM inside application/third-party directory.