Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Podlaczenie Doctrine
rad11
post 5.03.2015, 18:26:02
Post #1





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Probuje polaczyc doctrine do zwyklego projektu
http://doctrine-orm.readthedocs.org/en/lat...figuration.html

zastanawia mnie do czego ma prowadzic ta sciezka:

  1. /path/to/entity-files
Go to the top of the page
+Quote Post
Pyton_000
post 5.03.2015, 18:57:55
Post #2





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


Ścieżka w której będą przechowywane Encje (klasy opisujące tabelę)
Go to the top of the page
+Quote Post
rad11
post 5.03.2015, 19:12:51
Post #3





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Nie wiem co robie zle

http://stackoverflow.com/questions/1116830...octrine-2-2-orm

korzystajac z tego posta robie tak jak jest opisane ale otrzymuje komunikat


  1. 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
  2.  
  3. 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

  1. <?php
  2. use Doctrine\Common\ClassLoader,
  3. Doctrine\ORM\Configuration,
  4. Doctrine\ORM\EntityManager,
  5. Doctrine\Common\Cache\ArrayCache,
  6. Doctrine\DBAL\Logging\EchoSQLLogger;
  7.  
  8. class Doctrine{
  9.  
  10. public $em = null;
  11.  
  12. public function __construct()
  13. {
  14.  
  15. require_once 'Doctrine/Common/ClassLoader.php';
  16.  
  17. $doctrineClassLoader = new ClassLoader('Doctrine', '/');
  18. $doctrineClassLoader->register();
  19. $entitiesClassLoader = new ClassLoader('models', '/models/');
  20. $entitiesClassLoader->register();
  21. $proxiesClassLoader = new ClassLoader('Proxies', '/proxies/');
  22. $proxiesClassLoader->register();
  23.  
  24. // Set up caches
  25. $config = new Configuration;
  26. $cache = new ArrayCache;
  27. $config->setMetadataCacheImpl($cache);
  28. $driverImpl = $config->newDefaultAnnotationDriver(array('/models/Entities'));
  29. $config->setMetadataDriverImpl($driverImpl);
  30. $config->setQueryCacheImpl($cache);
  31.  
  32. $config->setQueryCacheImpl($cache);
  33.  
  34. // Proxy configuration
  35. $config->setProxyDir('/proxies');
  36. $config->setProxyNamespace('Proxies');
  37.  
  38. // Set up logger
  39. $logger = new EchoSQLLogger;
  40. //$config->setSQLLogger($logger);
  41.  
  42. $config->setAutoGenerateProxyClasses( TRUE );
  43.  
  44. // Database connection information
  45. $connectionOptions = array(
  46. 'driver' => 'pdo_mysql',
  47. 'user' => 'root',
  48. 'password' => '',
  49. 'host' => 'localhost',
  50. 'dbname' => 'baza'
  51. );
  52.  
  53. // Create EntityManager
  54. $this->em = EntityManager::create($connectionOptions, $config);
  55. }
  56. }



index.php

  1. <?php
  2. require "doctrine.php";
  3.  
  4. $doctrine = new Doctrine();
  5. $user = new models\User;
  6. $doctrine->em->persist($user);
  7. $doctrine->em->flush();
  8. ?>


Pomoze ktos zainstalowac ta biblioteke?

Ten post edytował rad11 5.03.2015, 19:13:28
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 25.06.2024 - 05:33