Author: romanb
Date: 2008-08-31 19:28:22 +0100 (Sun, 31 Aug 2008)
New Revision: 4867

Added:
   trunk/tests/models/company/
   trunk/tests/models/company/CompanyEmployee.php
   trunk/tests/models/company/CompanyManager.php
Log:
some more test models

Added: trunk/tests/models/company/CompanyEmployee.php
===================================================================
--- trunk/tests/models/company/CompanyEmployee.php                              
(rev 0)
+++ trunk/tests/models/company/CompanyEmployee.php      2008-08-31 18:28:22 UTC 
(rev 4867)
@@ -0,0 +1,41 @@
+<?php
+
+class CompanyEmployee extends Doctrine_Entity
+{
+    #protected $id;
+    #protected $salary;
+    #protected $department;
+    
+    public static function initMetadata($mapping)
+    {
+        // inheritance mapping
+        $mapping->setInheritanceType('joined', array(
+                'discriminatorColumn' => 'dtype',
+                'discriminatorMap' => array(
+                        'emp' => 'CompanyEmployee',
+                        'man' => 'CompanyManager')
+                ));
+        // register subclasses
+        $mapping->setSubclasses(array('CompanyManager'));
+        
+        $mapping->mapField(array(
+            'fieldName' => 'id',
+            'type' => 'integer',
+            'length' => 4,
+            'id' => true,
+            'idGenerator' => 'auto'
+        ));
+        $mapping->mapField(array(
+            'fieldName' => 'salary',
+            'type' => 'double'
+        ));
+        //TODO: make department an entity
+        $mapping->mapField(array(
+            'fieldName' => 'department',
+            'type' => 'string'
+        ));
+    }
+    
+}
+
+?>
\ No newline at end of file

Added: trunk/tests/models/company/CompanyManager.php
===================================================================
--- trunk/tests/models/company/CompanyManager.php                               
(rev 0)
+++ trunk/tests/models/company/CompanyManager.php       2008-08-31 18:28:22 UTC 
(rev 4867)
@@ -0,0 +1,14 @@
+<?php
+
+class CompanyManager extends CompanyEmployee
+{
+    public static function initMetadata($mapping)
+    {
+        $mapping->mapColumn(array(
+            'fieldName' => 'title',
+            'type' => 'string'
+        ));
+    }
+}
+
+?>
\ No newline at end of file


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to