Nie wiem co robie zle
http://stackoverflow.com/questions/1116830...octrine-2-2-ormkorzystajac z tego posta robie tak jak jest opisane ale otrzymuje komunikat
Warning
: require(/\Doctrine\ORM\Configuration
.php
): failed to open stream
: No such
file or directory in C
:\xampp\htdocs\doctrine\Doctrine\Common\ClassLoader
.php on line 182
Fatal error: require(): Failed opening required '/\Doctrine\ORM\Configuration.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\doctrine\Doctrine\Common\ClassLoader.php on line 182
plik 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()
{
require_once 'Doctrine/Common/ClassLoader.php';
$doctrineClassLoader = new ClassLoader('Doctrine', '/');
$doctrineClassLoader->register();
$entitiesClassLoader = new ClassLoader('models', '/models/');
$entitiesClassLoader->register();
$proxiesClassLoader = new ClassLoader('Proxies', '/proxies/');
$proxiesClassLoader->register();
// Set up caches
$config = new Configuration;
$cache = new ArrayCache;
$config->setMetadataCacheImpl($cache);
$driverImpl = $config->newDefaultAnnotationDriver(array('/models/Entities')); $config->setMetadataDriverImpl($driverImpl);
$config->setQueryCacheImpl($cache);
$config->setQueryCacheImpl($cache);
// Proxy configuration
$config->setProxyDir('/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' => 'root',
'password' => '',
'host' => 'localhost',
'dbname' => 'baza'
);
// Create EntityManager
$this->em = EntityManager::create($connectionOptions, $config);
}
}
index.php
<?php
require "doctrine.php";
$doctrine = new Doctrine();
$user = new models\User;
$doctrine->em->persist($user);
$doctrine->em->flush();
?>
Pomoze ktos zainstalowac ta biblioteke?
Ten post edytował rad11 5.03.2015, 19:13:28