User Tools

Site Tools


kurs:doctrine_oracle_beipspiel

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

kurs:doctrine_oracle_beipspiel [2012/01/19 13:54]
mh
kurs:doctrine_oracle_beipspiel [2014/09/10 21:22]
Line 1: Line 1:
-<​code>​ 
  
-<?php 
-// entities/​Test.php 
-class Test { 
-  protected $id; 
-  protected $name; 
- 
-  public function getName() { 
-        return $this->​name;​ 
-  } 
- 
-  public function setName($name) { 
-        $this->​name = $name; 
-  } 
- 
-  public function getId() { 
-        return $this->​id;​ 
-  } 
-} 
-</​code>​ 
- 
-XML 
- 
-<​code>​ 
-<!-- config/​xml/​Test.dcm.xml --> 
-<​doctrine-mapping xmlns="​http://​doctrine-project.org/​schemas/​orm/​doctrine-mapping"​ 
-      xmlns:​xsi="​http://​www.w3.org/​2001/​XMLSchema-instance"​ 
-      xsi:​schemaLocation="​http://​doctrine-project.org/​schemas/​orm/​doctrine-mapping 
-                    http://​doctrine-project.org/​schemas/​orm/​doctrine-mapping.xsd">​ 
- 
-      <entity name="​Test"​ table="​tests">​ 
-          <id name="​id"​ type="​integer">​ 
-              <​generator strategy="​AUTO"​ /> 
-          </id> 
- 
-          <field name="​name"​ type="​string"​ /> 
-      </​entity>​ 
-</​doctrine-mapping>​ 
-</​code>​ 
- 
-<​code>​ 
- 
-<?php 
-// bootstrap_doctrine.php 
- 
-// See :​doc:​`Configuration <​../​reference/​configuration>​` for up to date autoloading details. 
-use Doctrine\ORM\Tools\Setup;​ 
- 
-require_once "​Doctrine/​ORM/​Tools/​Setup.php";​ 
-Setup::​registerAutoloadPEAR();​ 
- 
-// Create a simple "​default"​ Doctrine ORM configuration for XML Mapping 
-$isDevMode = true; 
-$config = Setup::​createXMLMetadataConfiguration(array(__DIR__."/​config/​xml"​),​ $isDevMode);​ 
-// or if you prefer yaml or annotations 
-//$config = Setup::​createAnnotationMetadataConfiguration(array(__DIR__."/​entities"​),​ $isDevMode);​ 
-//$config = Setup::​createYAMLMetadataConfiguration(array(__DIR__."/​config/​yaml"​),​ $isDevMode);​ 
- 
-// database configuration parameters 
-$conn = array( 
-    '​dbname'​ => '​orcl',​ 
-    '​user'​ => '​hr',​ 
-    '​password'​ => '​hr',​ 
-    '​host'​ => '​10.0.2.15',​ 
-    '​port'​ => '​1521',​ 
-    '​driver'​ => '​oci8',​ 
-    '​charset'​ => '​NLS_CHARACTERSET',​ 
-); 
-// obtaining the entity manager 
-$entityManager = \Doctrine\ORM\EntityManager::​create($conn,​ $config); 
-</​code>​ 
- 
-<​code>​ 
-<?php 
-// bootstrap.php 
- 
-require_once "​entities/​Test.php";​ 
- 
-if (!class_exists("​Doctrine\Common\Version",​ false)) { 
-    require_once "​bootstrap_doctrine.php";​ 
-} 
-</​code>​ 
kurs/doctrine_oracle_beipspiel.txt ยท Last modified: 2014/09/10 21:22 (external edit)