Show
Ignore:
Timestamp:
08/06/08 07:55:11 (4 months ago)
Author:
ron
Message:

Merge in changes from 1.3 branch: merge -r 832:1067

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/generator

    • Property svn:ignore set to
      build.properties
  • trunk/generator/test/classes/bookstore/BookstoreDataPopulator.php

    r1024 r1068  
    2020 */ 
    2121 
    22 /* 
    23 require_once 'bookstore/Book.php'; 
    24 require_once 'bookstore/Author.php'; 
    25 require_once 'bookstore/Media.php'; 
    26 require_once 'bookstore/Publisher.php'; 
    27 require_once 'bookstore/Review.php'; 
    28 require_once 'bookstore/BookClubList.php'; 
    29 require_once 'bookstore/BookListRel.php'; 
    30 require_once 'bookstore/BookstoreEmployee.php'; 
    31 require_once 'bookstore/BookstoreManager.php'; 
    32 require_once 'bookstore/BookstoreCashier.php'; 
    33 require_once 'bookstore/BookstoreEmployeeAccount.php'; 
    34 */ 
    35  
    3622define('_LOB_SAMPLE_FILE_PATH', dirname(__FILE__) . '/../../etc/lob'); 
    3723 
     
    4733class BookstoreDataPopulator { 
    4834 
    49         public static function populate() { 
    50  
     35        public static function populate() 
     36        { 
    5137                // Add publisher records 
    5238                // --------------------- 
    53  
    54                 //print "\nAdding some new publishers to the list\n"; 
    55                 //print "--------------------------------------\n\n"; 
    5639 
    5740                $scholastic = new Publisher(); 
    5841                $scholastic->setName("Scholastic"); 
    5942                // do not save, will do later to test cascade 
    60                 //print "Added publisher \"Scholastic\" [not saved yet].\n"; 
    6143 
    6244                $morrow = new Publisher(); 
     
    6446                $morrow->save(); 
    6547                $morrow_id = $morrow->getId(); 
    66                 //print "Added publisher \"William Morrow\" [id = $morrow_id].\n"; 
    6748 
    6849                $penguin = new Publisher(); 
     
    7051                $penguin->save(); 
    7152                $penguin_id = $penguin->getId(); 
    72                 //print "Added publisher \"Penguin\" [id = $penguin_id].\n"; 
    7353 
    7454                $vintage = new Publisher(); 
     
    7656                $vintage->save(); 
    7757                $vintage_id = $vintage->getId(); 
    78                 //print "Added publisher \"Vintage\" [id = $vintage_id].\n"; 
    79  
    80  
    81                 // Add author records 
    82                 // ------------------ 
    83  
    84                 //print "\nAdding some new authors to the list\n"; 
    85                 //print "--------------------------------------\n\n"; 
    8658 
    8759                $rowling = new Author(); 
    8860                $rowling->setFirstName("J.K."); 
    8961                $rowling->setLastName("Rowling"); 
    90                 // print "Created author Rowling: " . (string) $rowling . "\n"; 
    9162                // no save() 
    92                 //print "Added author \"J.K. Rowling\" [not saved yet].\n"; 
    9363 
    9464                $stephenson = new Author(); 
     
    9767                $stephenson->save(); 
    9868                $stephenson_id = $stephenson->getId(); 
    99                 //print "Added author \"Neal Stephenson\" [id = $stephenson_id].\n"; 
    10069 
    10170                $byron = new Author(); 
     
    10473                $byron->save(); 
    10574                $byron_id = $byron->getId(); 
    106                 //print "Added author \"George Byron\" [id = $byron_id].\n"; 
    107  
    10875 
    10976                $grass = new Author(); 
     
    11279                $grass->save(); 
    11380                $grass_id = $grass->getId(); 
    114                 //print "Added author \"Gunter Grass\" [id = $grass_id].\n"; 
    115  
    116  
    117                 // Add book records 
    118                 // ---------------- 
    119  
    120                 //print "\nAdding some new books to the list\n"; 
    121                 //print "-------------------------------------\n\n"; 
    12281 
    12382                $phoenix = new Book(); 
     
    12988                $phoenix->save(); 
    13089                $phoenix_id = $phoenix->getId(); 
    131                 // print "Created book Phoenix: " . (string) $phoenix . "\n"; 
    132  
    133                 // print "Added book \"Harry Potter and the Order of the Phoenix\" [id = $phoenix_id].\n"; 
    13490 
    13591                $qs = new Book(); 
     
    14197                $qs->save(); 
    14298                $qs_id = $qs->getId(); 
    143                 // print "Added book \"Quicksilver\" [id = $qs_id].\n"; 
    14499 
    145100                $dj = new Book(); 
     
    151106                $dj->save(); 
    152107                $dj_id = $dj->getId(); 
    153                 // print "Added book \"Don Juan\" [id = $dj_id].\n"; 
    154108 
    155109                $td = new Book(); 
     
    161115                $td->save(); 
    162116                $td_id = $td->getId(); 
    163                 // print "Added book \"The Tin Drum\" [id = $td_id].\n"; 
    164  
    165                 // Add review records 
    166                 // ------------------ 
    167  
    168                 //print "\nAdding some book reviews to the list\n"; 
    169                 //print "------------------------------------\n\n"; 
    170117 
    171118                $r1 = new Review(); 
     
    176123                $r1->save(); 
    177124                $r1_id = $r1->getId(); 
    178                 //print "Added Washington Post book review  [id = $r1_id].\n"; 
    179125 
    180126                $r2 = new Review(); 
     
    185131                $r2->save(); 
    186132                $r2_id = $r2->getId(); 
    187                 //print "Added New York Times book review  [id = $r2_id].\n"; 
    188133 
    189134                $blob_path = _LOB_SAMPLE_FILE_PATH . '/tin_drum.gif'; 
     
    225170                $role = new AcctAccessRole(); 
    226171                $role->setName("Admin"); 
    227                  
     172 
    228173                $bempacct = new BookstoreEmployeeAccount(); 
    229174                $bempacct->setBookstoreEmployee($bemp1); 
     
    232177                $bempacct->setPassword("johnp4ss"); 
    233178                $bempacct->save(); 
    234                  
     179 
    235180                // Add bookstores 
    236181 
     
    248193        } 
    249194 
    250         public static function depopulate() { 
     195        public static function depopulate() 
     196        { 
     197                AcctAccessRolePeer::doDeleteAll(); 
    251198                AuthorPeer::doDeleteAll(); 
    252                 BookPeer::doDeleteAll(); 
    253                 PublisherPeer::doDeleteAll(); 
    254                 ReviewPeer::doDeleteAll(); 
    255                 MediaPeer::doDeleteAll(); 
    256                 BookClubListPeer::doDeleteAll(); 
     199                BookstorePeer::doDeleteAll(); 
     200                BookstoreContestPeer::doDeleteAll(); 
     201                BookstoreContestEntryPeer::doDeleteAll(); 
    257202                BookstoreEmployeePeer::doDeleteAll(); 
    258203                BookstoreEmployeeAccountPeer::doDeleteAll(); 
     204                BookstoreSalePeer::doDeleteAll(); 
     205                BookClubListPeer::doDeleteAll(); 
     206                BookOpinionPeer::doDeleteAll(); 
     207                BookReaderPeer::doDeleteAll(); 
     208                BookListRelPeer::doDeleteAll(); 
     209                BookPeer::doDeleteAll(); 
     210                ContestPeer::doDeleteAll(); 
    259211                CustomerPeer::doDeleteAll(); 
    260                 ContestPeer::doDeleteAll(); 
    261                 BookstoreContestPeer::doDeleteAll(); 
    262                 BookstoreContestEntryPeer::doDeleteAll(); 
    263                 BookstorePeer::doDeleteAll(); 
     212                MediaPeer::doDeleteAll(); 
     213                PublisherPeer::doDeleteAll(); 
     214                ReaderFavoritePeer::doDeleteAll(); 
     215                ReviewPeer::doDeleteAll(); 
    264216        } 
    265217