Changeset 4699 for trunk/tests/models

Show
Ignore:
Timestamp:
07/20/08 21:13:24 (6 months ago)
Author:
romanb
Message:

Checkin of occasional work from the past weeks.

Location:
trunk/tests/models
Files:
1 added
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/models/cms/CmsArticle.php

    r4422 r4699  
    11<?php 
     2 
     3#namespace Doctrine::Tests::ORM::Models::CMS; 
     4 
     5#use Doctrine::ORM::Entity; 
     6 
    27class CmsArticle extends Doctrine_Entity 
    38{ 
    4   public static function initMetadata($class)  
    5   { 
    6       $class->mapColumn('id', 'integer', 4, array('primary' => true, 'autoincrement' => true)); 
    7       $class->mapColumn('topic', 'string', 255); 
    8       $class->mapColumn('text', 'string'); 
    9       $class->mapColumn('user_id', 'integer', 4); 
    10       $class->hasMany('CmsComment as comments', array( 
    11             'local' => 'id', 'foreign' => 'article_id')); 
    12   } 
     9    #protected $id; 
     10    #protected $topic; 
     11    #protected $text; 
     12    #protected $user_id; 
     13     
     14    public static function initMetadata($mapping)  
     15    { 
     16        $mapping->mapField(array( 
     17            'fieldName' => 'id', 
     18            'type' => 'integer', 
     19            'length' => 4, 
     20            'id' => true, 
     21            'generatorType' => 'auto' 
     22        )); 
     23        $mapping->mapField(array( 
     24            'fieldName' => 'topic', 
     25            'type' => 'string', 
     26            'length' => 255 
     27        )); 
     28        $mapping->mapField(array( 
     29            'fieldName' => 'text', 
     30            'type' => 'string' 
     31        )); 
     32        $mapping->mapField(array( 
     33            'fieldName' => 'user_id', 
     34            'type' => 'integer', 
     35            'length' => 4 
     36        )); 
     37        $mapping->hasMany('CmsComment as comments', array( 
     38              'local' => 'id', 'foreign' => 'article_id')); 
     39    } 
    1340} 
  • trunk/tests/models/cms/CmsComment.php

    r4422 r4699  
    11<?php 
     2 
     3#namespace Doctrine::Tests::ORM::Models::CMS; 
     4 
     5#use Doctrine::ORM::Entity; 
     6 
    27class CmsComment extends Doctrine_Entity 
    38{ 
    4   public static function initMetadata($class)  
    5   { 
    6       $class->mapColumn('id', 'integer', 4, array('primary' => true, 'autoincrement' => true)); 
    7       $class->mapColumn('topic', 'string', 255); 
    8       $class->mapColumn('text', 'string'); 
    9       $class->mapColumn('article_id', 'integer', 4); 
    10   } 
     9    #protected $id; 
     10    #protected $topic; 
     11    #protected $text; 
     12    #protected $article_id; 
     13     
     14    public static function initMetadata($mapping) 
     15    { 
     16        $mapping->mapField(array( 
     17            'fieldName' => 'id', 
     18            'type' => 'integer', 
     19            'length' => 4, 
     20            'id' => true, 
     21            'generatorType' => 'auto' 
     22        )); 
     23        $mapping->mapField(array( 
     24            'fieldName' => 'topic', 
     25            'type' => 'string', 
     26            'length' => 255 
     27        )); 
     28        $mapping->mapField(array( 
     29            'fieldName' => 'text', 
     30            'type' => 'string' 
     31        )); 
     32        $mapping->mapField(array( 
     33            'fieldName' => 'article_id', 
     34            'type' => 'integer', 
     35            'length' => 4 
     36        )); 
     37    } 
    1138} 
  • trunk/tests/models/cms/CmsPhonenumber.php

    r4422 r4699  
    22class CmsPhonenumber extends Doctrine_Entity 
    33{ 
    4   public static function initMetadata($class) 
    5   { 
    6       $class->mapColumn('user_id', 'integer', 4); 
    7       $class->mapColumn('phonenumber', 'string', 50, array('primary' => true)); 
    8   } 
     4    #protected $user_id; 
     5    #protected $phonenumber; 
     6     
     7    public static function initMetadata($mapping) 
     8    { 
     9        $mapping->mapField(array( 
     10            'fieldName' => 'user_id', 
     11            'type' => 'integer', 
     12            'length' => 4 
     13        )); 
     14        $mapping->mapField(array( 
     15            'fieldName' => 'phonenumber', 
     16            'type' => 'string', 
     17            'length' => 50, 
     18            'id' => true 
     19        )); 
     20    } 
    921} 
  • trunk/tests/models/cms/CmsUser.php

    r4374 r4699  
    11<?php 
     2 
     3#namespace Doctrine::Test::ORM::Models; 
     4 
     5#use Doctrine::ORM::Entity; 
     6 
    27class CmsUser extends Doctrine_Entity 
    38{ 
    4   public static function initMetadata($class)  
    5   { 
    6       $class->mapColumn('id', 'integer', 4, array('primary' => true, 'autoincrement' => true)); 
    7       $class->mapColumn('status', 'string', 50); 
    8       $class->mapColumn('username', 'string', 255); 
    9       $class->mapColumn('name', 'string', 255); 
    10        
    11       $class->hasMany('CmsPhonenumber as phonenumbers', array( 
     9    #protected $id; 
     10    #protected $status; 
     11    #protected $username; 
     12    #protected $name; 
     13     
     14    public static function initMetadata($mapping) 
     15    { 
     16        $mapping->mapField(array( 
     17            'fieldName' => 'id', 
     18            'type' => 'integer', 
     19            'length' => 4, 
     20            'id' => true, 
     21            'generatorType' => 'auto' 
     22        )); 
     23        $mapping->mapField(array( 
     24            'fieldName' => 'status', 
     25            'type' => 'string', 
     26            'length' => 50 
     27        )); 
     28        $mapping->mapField(array( 
     29            'fieldName' => 'username', 
     30            'type' => 'string', 
     31            'length' => 255 
     32        )); 
     33        $mapping->mapField(array( 
     34            'fieldName' => 'name', 
     35            'type' => 'string', 
     36            'length' => 255 
     37        )); 
     38 
     39        $mapping->hasMany('CmsPhonenumber as phonenumbers', array( 
    1240              'local' => 'id', 'foreign' => 'user_id')); 
    13       $class->hasMany('CmsArticle as articles', array( 
     41        $mapping->hasMany('CmsArticle as articles', array( 
    1442              'local' => 'id', 'foreign' => 'user_id')); 
    15   } 
     43    } 
    1644} 
  • trunk/tests/models/forum/ForumAdministrator.php

    r4101 r4699  
    33class ForumAdministrator extends ForumUser 
    44{ 
    5     public static function initMetadata($class)  
     5    public static function initMetadata($mapping)  
    66    { 
    7         $class->mapColumn('access_level as accessLevel', 'integer', 1); 
     7        $mapping->mapField(array( 
     8            'fieldName' => 'accessLevel', 
     9            'columnName' => 'access_level', 
     10            'type' => 'integer', 
     11            'length' => 1 
     12        )); 
    813    } 
    914     
  • trunk/tests/models/forum/ForumBoard.php

    r4653 r4699  
    11<?php 
    2 class ForumBoard extends Doctrine_Entity { 
    3     public static function initMetadata($metadata) { 
     2class ForumBoard extends Doctrine_Entity 
     3{ 
     4    public static function initMetadata($mapping) 
     5    { 
    46        /*$metadata->mapField(array( 
    57            'fieldName' => 'id', 
     
    911            )); 
    1012        */ 
    11         $metadata->mapColumn('id', 'integer', 4, array('primary')); 
    12         $metadata->mapColumn('position', 'integer'); 
    13         $metadata->mapColumn('category_id', 'integer'); 
    14         $metadata->hasOne('ForumCategory as category', 
     13        $mapping->mapField(array( 
     14            'fieldName' => 'id', 
     15            'type' => 'integer', 
     16            'length' => 4, 
     17            'id' => true 
     18        )); 
     19        $mapping->mapField(array( 
     20            'fieldName' => 'position', 
     21            'type' => 'integer' 
     22        )); 
     23        $mapping->mapField(array( 
     24            'fieldName' => 'category_id', 
     25            'type' => 'integer' 
     26        )); 
     27         
     28        $mapping->hasOne('ForumCategory as category', 
    1529                array('local' => 'category_id', 'foreign' => 'id')); 
    1630        /*        
  • trunk/tests/models/forum/ForumCategory.php

    r4653 r4699  
    11<?php 
    2 class ForumCategory extends Doctrine_Entity { 
    3     public static function initMetadata($class) { 
    4         $class->mapColumn('id', 'integer', 4, array('primary')); 
    5         $class->mapColumn('position', 'integer'); 
    6         $class->mapColumn('name', 'string', 255); 
    7         $class->hasMany('ForumBoard as boards', array( 
     2class ForumCategory extends Doctrine_Entity 
     3{ 
     4     
     5    public static function initMetadata($mapping) 
     6    { 
     7        $mapping->mapField(array( 
     8            'fieldName' => 'id', 
     9            'type' => 'integer', 
     10            'length' => 4, 
     11            'id' => true 
     12        )); 
     13        $mapping->mapField(array( 
     14            'fieldName' => 'position', 
     15            'type' => 'integer' 
     16        )); 
     17        $mapping->mapField(array( 
     18            'fieldName' => 'name', 
     19            'type' => 'string', 
     20            'length' => 255 
     21        )); 
     22         
     23        $mapping->hasMany('ForumBoard as boards', array( 
    824                'local' => 'id' , 'foreign' => 'category_id'));  
    925    } 
  • trunk/tests/models/forum/ForumUser.php

    r4437 r4699  
    11<?php 
     2 
     3#namespace Doctrine::Tests::ORM::Models::Forum; 
     4 
     5#use Doctrine::ORM::Entity; 
    26 
    37class ForumUser extends Doctrine_Entity 
    48{ 
    5     public static function initMetadata($class)  
     9    #protected $dtype; 
     10    #protected $id; 
     11    #protected $username; 
     12     
     13    public static function initMetadata($mapping)  
    614    { 
    715        // inheritance mapping 
    8         $class->setInheritanceType(Doctrine::INHERITANCE_TYPE_JOINED, array( 
     16        $mapping->setInheritanceType('joined', array( 
    917                'discriminatorColumn' => 'dtype', 
    1018                'discriminatorMap' => array( 
     
    1321                )); 
    1422        // register subclasses 
    15         $class->setSubclasses(array('ForumAdministrator')); 
     23        $mapping->setSubclasses(array('ForumAdministrator')); 
    1624        // the discriminator column 
    17         $class->mapColumn('dtype', 'string', 50); 
     25        $mapping->mapField(array( 
     26            'fieldName' => 'dtype', 
     27            'type' => 'string', 
     28            'length' => 50 
     29        )); 
    1830         
    1931        // column-to-field mapping 
    20         $class->mapColumn('id', 'integer', 4, array( 
    21                 'primary' => true, 
    22                 'autoincrement' => true)); 
    23         $class->mapColumn('username', 'string', 50, array()); 
     32        $mapping->mapField(array( 
     33            'fieldName' => 'id', 
     34            'type' => 'integer', 
     35            'length' => 4, 
     36            'id' => true, 
     37            'generatorType' => 'auto' 
     38        )); 
     39        $mapping->mapField(array( 
     40            'fieldName' => 'username', 
     41            'type' => 'string', 
     42            'length' => 50 
     43        )); 
    2444         
    2545    }