Show
Ignore:
Timestamp:
09/20/05 00:31:05 (3 years ago)
Author:
sfuchs
Message:

updated examples (Propel bookstore classes) with Propel svn head versions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/examples/propel/bookstore/Author.php

    r215 r338  
    11<?php 
     2 
    23require_once 'bookstore/om/BaseAuthor.php'; 
    34 
    4 /**  
    5  * The skeleton for this class was autogenerated by Propel  on: 
     5 
     6/** 
     7 * Skeleton subclass for representing a row from the 'author' table. 
    68 * 
    7  * [05/12/05 21:16:11] 
     9 * Author Table 
     10 * 
     11 * This class was autogenerated by Propel on: 
     12 * 
     13 * 09/19/05 14:48:49 
    814 * 
    915 * You should add additional methods to this class to meet the 
     
    1117 * long as it does not already exist in the output directory. 
    1218 * 
    13  * @package bookstore  
    14  */ 
     19 * @package bookstore 
     20 */     
    1521class Author extends BaseAuthor { 
    1622 
    17 } 
     23} // Author 
  • trunk/examples/propel/bookstore/AuthorPeer.php

    r215 r338  
    11<?php 
    2 // The parent class 
    3 require_once 'bookstore/om/BaseAuthorPeer.php'; 
    42 
    5 // The object class 
    6 include_once 'bookstore/Author.php'; 
     3  // include base peer class 
     4  require_once 'bookstore/om/BaseAuthorPeer.php'; 
     5   
     6  // include object class 
     7  include_once 'bookstore/Author.php'; 
    78 
    8 /**  
    9  * The skeleton for this class was autogenerated by Propel on: 
     9 
     10/** 
     11 * Skeleton subclass for performing query and update operations on the 'author' table. 
    1012 * 
    11  * [05/12/05 21:16:11] 
     13 * Author Table 
    1214 * 
    13  *  You should add additional methods to this class to meet the 
    14  *  application requirements.  This class will only be generated as 
    15  *  long as it does not already exist in the output directory. 
     15 * This class was autogenerated by Propel on: 
    1616 * 
    17  * @package bookstore  
    18  */ 
     17 * 09/19/05 14:48:49 
     18 * 
     19 * You should add additional methods to this class to meet the 
     20 * application requirements.  This class will only be generated as 
     21 * long as it does not already exist in the output directory. 
     22 * 
     23 * @package bookstore 
     24 */  
    1925class AuthorPeer extends BaseAuthorPeer { 
    2026 
    21 } 
     27} // AuthorPeer 
  • trunk/examples/propel/bookstore/Book.php

    r215 r338  
    11<?php 
     2 
    23require_once 'bookstore/om/BaseBook.php'; 
    34 
    4 /**  
    5  * The skeleton for this class was autogenerated by Propel  on: 
     5 
     6/** 
     7 * Skeleton subclass for representing a row from the 'book' table. 
    68 * 
    7  * [05/12/05 21:16:11] 
     9 * Book Table 
     10 * 
     11 * This class was autogenerated by Propel on: 
     12 * 
     13 * 09/19/05 14:48:49 
    814 * 
    915 * You should add additional methods to this class to meet the 
     
    1117 * long as it does not already exist in the output directory. 
    1218 * 
    13  * @package bookstore  
    14  */ 
     19 * @package bookstore 
     20 */     
    1521class Book extends BaseBook { 
    1622 
    17 } 
     23} // Book 
  • trunk/examples/propel/bookstore/BookPeer.php

    r215 r338  
    11<?php 
    2 // The parent class 
    3 require_once 'bookstore/om/BaseBookPeer.php'; 
    42 
    5 // The object class 
    6 include_once 'bookstore/Book.php'; 
     3  // include base peer class 
     4  require_once 'bookstore/om/BaseBookPeer.php'; 
     5   
     6  // include object class 
     7  include_once 'bookstore/Book.php'; 
    78 
    8 /**  
    9  * The skeleton for this class was autogenerated by Propel on: 
     9 
     10/** 
     11 * Skeleton subclass for performing query and update operations on the 'book' table. 
    1012 * 
    11  * [05/12/05 21:16:11] 
     13 * Book Table 
    1214 * 
    13  *  You should add additional methods to this class to meet the 
    14  *  application requirements.  This class will only be generated as 
    15  *  long as it does not already exist in the output directory. 
     15 * This class was autogenerated by Propel on: 
    1616 * 
    17  * @package bookstore  
    18  */ 
     17 * 09/19/05 14:48:49 
     18 * 
     19 * You should add additional methods to this class to meet the 
     20 * application requirements.  This class will only be generated as 
     21 * long as it does not already exist in the output directory. 
     22 * 
     23 * @package bookstore 
     24 */  
    1925class BookPeer extends BaseBookPeer { 
    2026 
    21 } 
     27} // BookPeer 
  • trunk/examples/propel/bookstore/Publisher.php

    r215 r338  
    11<?php 
     2 
    23require_once 'bookstore/om/BasePublisher.php'; 
    34 
    4 /**  
    5  * The skeleton for this class was autogenerated by Propel  on: 
     5 
     6/** 
     7 * Skeleton subclass for representing a row from the 'publisher' table. 
    68 * 
    7  * [05/12/05 21:16:11] 
     9 * Publisher Table 
     10 * 
     11 * This class was autogenerated by Propel on: 
     12 * 
     13 * 09/19/05 14:48:49 
    814 * 
    915 * You should add additional methods to this class to meet the 
     
    1117 * long as it does not already exist in the output directory. 
    1218 * 
    13  * @package bookstore  
    14  */ 
     19 * @package bookstore 
     20 */     
    1521class Publisher extends BasePublisher { 
    1622 
    17 } 
     23} // Publisher 
  • trunk/examples/propel/bookstore/PublisherPeer.php

    r335 r338  
    11<?php 
    2 // The parent class 
    3 require_once 'bookstore/om/BasePublisherPeer.php'; 
    42 
    5 // The object class 
    6 include_once 'bookstore/Publisher.php'; 
     3  // include base peer class 
     4  require_once 'bookstore/om/BasePublisherPeer.php'; 
     5   
     6  // include object class 
     7  include_once 'bookstore/Publisher.php'; 
    78 
    8 /**  
    9  * The skeleton for this class was autogenerated by Propel on: 
     9 
     10/** 
     11 * Skeleton subclass for performing query and update operations on the 'publisher' table. 
    1012 * 
    11  * [05/12/05 21:16:11] 
     13 * Publisher Table 
    1214 * 
    13  *  You should add additional methods to this class to meet the 
    14  *  application requirements.  This class will only be generated as 
    15  *  long as it does not already exist in the output directory. 
     15 * This class was autogenerated by Propel on: 
    1616 * 
    17  * @package bookstore  
    18  */ 
     17 * 09/19/05 14:48:49 
     18 * 
     19 * You should add additional methods to this class to meet the 
     20 * application requirements.  This class will only be generated as 
     21 * long as it does not already exist in the output directory. 
     22 * 
     23 * @package bookstore 
     24 */  
    1925class PublisherPeer extends BasePublisherPeer { 
    2026 
    21 } 
     27} // PublisherPeer 
  • trunk/examples/propel/bookstore/map/AuthorMapBuilder.php

    r215 r338  
    11<?php 
     2         
    23require_once 'propel/map/MapBuilder.php'; 
    34include_once 'creole/CreoleTypes.php'; 
    45 
     6 
    57/** 
    68 * This class adds structure of 'author' table to 'bookstore' DatabaseMap object. 
     9 * 
     10 * 
     11 * This class was autogenerated by Propel on: 
     12 * 
     13 * 09/19/05 20:42:23 
     14 * 
    715 * 
    816 * These statically-built map classes are used by Propel to do runtime db structure discovery. 
     
    1119 * (i.e. if it's a text column type). 
    1220 * 
    13  *  This class was autogenerated by Propel on: 
    14  * 
    15  * [05/12/05 21:28:42] 
    16  * 
    17  * @see BasePeer 
    18  * @see DatabaseMap 
    1921 * @package bookstore.map 
    20  */ 
    21 class AuthorMapBuilder implements MapBuilder
     22 */     
     23class AuthorMapBuilder
    2224 
    23     /** 
    24      * The name of this class 
    25     */ 
    26     const CLASS_NAME = "bookstore.map.AuthorMapBuilder"; 
    27      
     25   /** 
     26    * The (dot-path) name of this class 
     27    */ 
     28    const CLASS_NAME = 'bookstore.map.AuthorMapBuilder';     
     29 
    2830    /** 
    2931     * The database map. 
    3032     */ 
    31     private $dbMap = null
     33    private $dbMap
    3234 
    33     /** 
     35   /** 
    3436     * Tells us if this DatabaseMapBuilder is built so that we 
    3537     * don't have to re-build it every time. 
    3638     * 
    37      * @return true if this DatabaseMapBuilder is built 
     39     * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    3840     */ 
    3941    public function isBuilt() 
     
    4244    } 
    4345 
    44     /** 
     46   /** 
    4547     * Gets the databasemap this map builder built. 
    4648     * 
     
    6062    public function doBuild() 
    6163    { 
    62         $this->dbMap = Propel::getDatabaseMap("bookstore"); 
     64        $this->dbMap = Propel::getDatabaseMap('bookstore'); 
    6365         
    64         $tMap = $this->dbMap->addTable("author"); 
    65         $tMap->setPhpName("Author"); 
    66          
    67           
     66        $tMap = $this->dbMap->addTable('author'); 
     67        $tMap->setPhpName('Author'); 
     68 
    6869        $tMap->setUseIdGenerator(true); 
    69           
    70                          
    71           
    72          
    73         // Add columns to map 
    74         $tMap->addPrimaryKey("ID", "Id", "int", CreoleTypes::INTEGER, true); 
    75         $tMap->addColumn("FIRST_NAME", "FirstName", "string", CreoleTypes::VARCHAR, true, 128); 
    76         $tMap->addColumn("LAST_NAME", "LastName", "string", CreoleTypes::VARCHAR, true, 128); 
    77         $tMap->addColumn("EMAIL", "Email", "string", CreoleTypes::VARCHAR, false, 128); 
    78         $tMap->addColumn("AGE", "Age", "int", CreoleTypes::INTEGER, false, null); 
    79         $tMap->addValidator("LAST_NAME", "required", "propel.validator.RequiredValidator", "", "The last name field is required."); 
    80         $tMap->addValidator("EMAIL", "match", "propel.validator.MatchValidator", "/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/", "Please enter a valid email address."); 
    81         $tMap->addValidator("AGE", "minValue", "propel.validator.MinValueValidator", "0", "Please enter a positive number."); 
    82         $tMap->addValidator("AGE", "maxValue", "propel.validator.MaxValueValidator", "100", "Impressive age! Just kidding, hm?"); 
     70 
     71        $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true); 
     72 
     73        $tMap->addColumn('FIRST_NAME', 'FirstName', 'string', CreoleTypes::VARCHAR, true, 128); 
     74 
     75        $tMap->addColumn('LAST_NAME', 'LastName', 'string', CreoleTypes::VARCHAR, true, 128); 
     76 
     77        $tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, false, 128); 
     78 
     79        $tMap->addColumn('AGE', 'Age', 'int', CreoleTypes::INTEGER, false, null); 
     80 
     81        $tMap->addValidator('LAST_NAME', 'required', 'propel.validator.RequiredValidator', '', 'The last name field is required.'); 
     82 
     83        $tMap->addValidator('EMAIL', 'match', 'propel.validator.MatchValidator', '/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/', 'Please enter a valid email address.'); 
     84 
     85        $tMap->addValidator('AGE', 'minValue', 'propel.validator.MinValueValidator', '0', 'Please enter a positive number.'); 
     86 
     87        $tMap->addValidator('AGE', 'maxValue', 'propel.validator.MaxValueValidator', '100', 'Impressive age! Just kidding, hm?'); 
    8388                 
    84     } 
    85 
     89    } // doBuild() 
     90 
     91} // AuthorMapBuilder 
  • trunk/examples/propel/bookstore/map/BookMapBuilder.php

    r215 r338  
    11<?php 
     2         
    23require_once 'propel/map/MapBuilder.php'; 
    34include_once 'creole/CreoleTypes.php'; 
    45 
     6 
    57/** 
    68 * This class adds structure of 'book' table to 'bookstore' DatabaseMap object. 
     9 * 
     10 * 
     11 * This class was autogenerated by Propel on: 
     12 * 
     13 * 09/19/05 20:42:23 
     14 * 
    715 * 
    816 * These statically-built map classes are used by Propel to do runtime db structure discovery. 
     
    1119 * (i.e. if it's a text column type). 
    1220 * 
    13  *  This class was autogenerated by Propel on: 
    14  * 
    15  * [05/12/05 21:28:42] 
    16  * 
    17  * @see BasePeer 
    18  * @see DatabaseMap 
    1921 * @package bookstore.map 
    20  */ 
    21 class BookMapBuilder implements MapBuilder
     22 */     
     23class BookMapBuilder
    2224 
    23     /** 
    24      * The name of this class 
    25     */ 
    26     const CLASS_NAME = "bookstore.map.BookMapBuilder"; 
    27      
     25   /** 
     26    * The (dot-path) name of this class 
     27    */ 
     28    const CLASS_NAME = 'bookstore.map.BookMapBuilder';   
     29 
    2830    /** 
    2931     * The database map. 
    3032     */ 
    31     private $dbMap = null
     33    private $dbMap
    3234 
    33     /** 
     35   /** 
    3436     * Tells us if this DatabaseMapBuilder is built so that we 
    3537     * don't have to re-build it every time. 
    3638     * 
    37      * @return true if this DatabaseMapBuilder is built 
     39     * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    3840     */ 
    3941    public function isBuilt() 
     
    4244    } 
    4345 
    44     /** 
     46   /** 
    4547     * Gets the databasemap this map builder built. 
    4648     * 
     
    6062    public function doBuild() 
    6163    { 
    62         $this->dbMap = Propel::getDatabaseMap("bookstore"); 
     64        $this->dbMap = Propel::getDatabaseMap('bookstore'); 
    6365         
    64         $tMap = $this->dbMap->addTable("book"); 
    65         $tMap->setPhpName("Book"); 
    66          
    67           
     66        $tMap = $this->dbMap->addTable('book'); 
     67        $tMap->setPhpName('Book'); 
     68 
    6869        $tMap->setUseIdGenerator(true); 
    69           
    70                          
    71           
    72          
    73         // Add columns to map 
    74         $tMap->addPrimaryKey("ID", "Id", "int", CreoleTypes::INTEGER, true); 
    75         $tMap->addColumn("TITLE", "Title", "string", CreoleTypes::VARCHAR, true, 255); 
    76         $tMap->addColumn("ISBN", "ISBN", "string", CreoleTypes::VARCHAR, true, 24); 
    77         $tMap->addForeignKey("PUBLISHER_ID", "PublisherId", "int", CreoleTypes::INTEGER, "publisher" , "ID", false); 
    78         $tMap->addForeignKey("AUTHOR_ID", "AuthorId", "int", CreoleTypes::INTEGER, "author" , "ID", false); 
    79         $tMap->addValidator("TITLE", "unique", "propel.validator.UniqueValidator", "", "Book title already in database."); 
    80         $tMap->addValidator("TITLE", "minLength", "propel.validator.MinLengthValidator", "10", "Book title must be more than 10 characters long."); 
    81         $tMap->addValidator("TITLE", "maxLength", "propel.validator.MaxLengthValidator", "255", "Book title must not be longer than 255 characters."); 
    82         $tMap->addValidator("ISBN", "notMatch", "propel.validator.NotMatchValidator", "/[^\d-]+/", "The ISBN contains invalid characters."); 
     70 
     71        $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true); 
     72 
     73        $tMap->addColumn('TITLE', 'Title', 'string', CreoleTypes::VARCHAR, true, 255); 
     74 
     75        $tMap->addColumn('ISBN', 'ISBN', 'string', CreoleTypes::VARCHAR, true, 24); 
     76 
     77        $tMap->addForeignKey('PUBLISHER_ID', 'PublisherId', 'int', CreoleTypes::INTEGER, 'publisher', 'ID', false); 
     78 
     79        $tMap->addForeignKey('AUTHOR_ID', 'AuthorId', 'int', CreoleTypes::INTEGER, 'author', 'ID', false); 
     80 
     81        $tMap->addValidator('TITLE', 'unique', 'propel.validator.UniqueValidator', '', 'Book title already in database.'); 
     82 
     83        $tMap->addValidator('TITLE', 'minLength', 'propel.validator.MinLengthValidator', '10', 'Book title must be more than 10 characters long.'); 
     84 
     85        $tMap->addValidator('TITLE', 'maxLength', 'propel.validator.MaxLengthValidator', '255', 'Book title must not be longer than 255 characters.'); 
     86 
     87        $tMap->addValidator('ISBN', 'notMatch', 'propel.validator.NotMatchValidator', '/[^\d-]+/', 'The ISBN contains invalid characters.'); 
    8388                 
    84     } 
    85 
     89    } // doBuild() 
     90 
     91} // BookMapBuilder 
  • trunk/examples/propel/bookstore/map/PublisherMapBuilder.php

    r215 r338  
    11<?php 
     2         
    23require_once 'propel/map/MapBuilder.php'; 
    34include_once 'creole/CreoleTypes.php'; 
    45 
     6 
    57/** 
    68 * This class adds structure of 'publisher' table to 'bookstore' DatabaseMap object. 
     9 * 
     10 * 
     11 * This class was autogenerated by Propel on: 
     12 * 
     13 * 09/19/05 20:42:23 
     14 * 
    715 * 
    816 * These statically-built map classes are used by Propel to do runtime db structure discovery. 
     
    1119 * (i.e. if it's a text column type). 
    1220 * 
    13  *  This class was autogenerated by Propel on: 
    14  * 
    15  * [05/12/05 21:28:42] 
    16  * 
    17  * @see BasePeer 
    18  * @see DatabaseMap 
    1921 * @package bookstore.map 
    20  */ 
    21 class PublisherMapBuilder implements MapBuilder
     22 */     
     23class PublisherMapBuilder
    2224 
    23     /** 
    24      * The name of this class 
    25     */ 
    26     const CLASS_NAME = "bookstore.map.PublisherMapBuilder"; 
    27      
     25   /** 
     26    * The (dot-path) name of this class 
     27    */ 
     28    const CLASS_NAME = 'bookstore.map.PublisherMapBuilder';  
     29 
    2830    /** 
    2931     * The database map. 
    3032     */ 
    31     private $dbMap = null
     33    private $dbMap
    3234 
    33     /** 
     35   /** 
    3436     * Tells us if this DatabaseMapBuilder is built so that we 
    3537     * don't have to re-build it every time. 
    3638     * 
    37      * @return true if this DatabaseMapBuilder is built 
     39     * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    3840     */ 
    3941    public function isBuilt() 
     
    4244    } 
    4345 
    44     /** 
     46   /** 
    4547     * Gets the databasemap this map builder built. 
    4648     * 
     
    6062    public function doBuild() 
    6163    { 
    62         $this->dbMap = Propel::getDatabaseMap("bookstore"); 
     64        $this->dbMap = Propel::getDatabaseMap('bookstore'); 
    6365         
    64         $tMap = $this->dbMap->addTable("publisher"); 
    65         $tMap->setPhpName("Publisher"); 
    66          
    67           
     66        $tMap = $this->dbMap->addTable('publisher'); 
     67        $tMap->setPhpName('Publisher'); 
     68 
    6869        $tMap->setUseIdGenerator(true); 
    69           
    70                          
    71           
    72          
    73         // Add columns to map 
    74         $tMap->addPrimaryKey("ID", "Id", "int", CreoleTypes::INTEGER, true); 
    75         $tMap->addColumn("NAME", "Name", "string", CreoleTypes::VARCHAR, true, 128); 
     70 
     71        $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true); 
     72 
     73        $tMap->addColumn('NAME', 'Name', 'string', CreoleTypes::VARCHAR, true, 128); 
    7674                 
    77     } 
    78 
     75    } // doBuild() 
     76 
     77} // PublisherMapBuilder 
  • trunk/examples/propel/bookstore/om/BaseAuthor.php

    r215 r338  
    11<?php 
     2 
    23require_once 'propel/om/BaseObject.php'; 
    34 
     
    1213 * Base class that represents a row from the 'author' table. 
    1314 * 
    14  * Author Table * 
     15 * Author Table 
     16 * 
    1517 * This class was autogenerated by Propel on: 
    1618 * 
    17  * [05/12/05 21:28:42] 
     19 * 09/19/05 20:42:23 
    1820 * 
    19  * You should not use this class directly.  It should not even be 
    20  * extended; all references should be to Author class. 
    21  * 
    22  * @package bookstore */ 
    23 abstract class BaseAuthor extends BaseObject implements Persistent { 
     21 * @package bookstore.om 
     22 */ 
     23abstract class BaseAuthor extends BaseObject  implements Persistent { 
     24 
    2425 
    2526    /** 
     
    3132    protected static $peer; 
    3233 
     34 
    3335    /** 
    3436     * The value for the id field. 
    35      * @var int  */ 
     37     * @var int 
     38     */ 
    3639    protected $id; 
    3740 
     41 
    3842    /** 
    3943     * The value for the first_name field. 
    40      * @var string   */ 
     44     * @var string 
     45     */ 
    4146    protected $first_name; 
    4247 
     48 
    4349    /** 
    4450     * The value for the last_name field. 
    45      * @var string   */ 
     51     * @var string 
     52     */ 
    4653    protected $last_name; 
    4754 
     55 
    4856    /** 
    4957     * The value for the email field. 
    50      * @var string   */ 
     58     * @var string 
     59     */ 
    5160    protected $email; 
    5261 
     62 
    5363    /** 
    5464     * The value for the age field. 
    55      * @var int  */ 
     65     * @var int 
     66     */ 
    5667    protected $age; 
    57     /** 
    58      * Get the Id column value. 
    59      * Author Id     * @return int   */ 
     68 
     69    /** 
     70     * Collection to store aggregation of collBooks. 
     71     * @var array 
     72     */ 
     73    protected $collBooks; 
     74     
     75    /** 
     76     * The criteria used to select the current contents of collBooks. 
     77     * @var Criteria 
     78     */ 
     79    private $lastBookCriteria = null; 
     80 
     81    /** 
     82     * Flag to prevent endless save loop, if this object is referenced 
     83     * by another object which falls in this transaction. 
     84     * @var boolean 
     85     */ 
     86    private $alreadyInSave = false; 
     87 
     88    /** 
     89     * Flag to prevent endless validation loop, if this object is referenced 
     90     * by another object which falls in this transaction. 
     91     * @var boolean 
     92     */ 
     93    private $alreadyInValidation = false; 
     94 
     95    /** 
     96     * Get the [id] column value. 
     97     * Author Id 
     98     * @return int 
     99     */ 
    60100    public function getId() 
    61101    { 
     102 
    62103        return $this->id; 
    63104    } 
    64105 
    65  
    66     /** 
    67      * Set the value of `id` column. 
    68      * Author Id     * @param int $v new value 
    69      * @return void 
    70      * @throws PropelException   */ 
     106    /** 
     107     * Get the [first_name] column value. 
     108     * First Name 
     109     * @return string 
     110     */ 
     111    public function getFirstName() 
     112    { 
     113 
     114        return $this->first_name; 
     115    } 
     116 
     117    /** 
     118     * Get the [last_name] column value. 
     119     * Last Name 
     120     * @return string 
     121     */ 
     122    public function getLastName() 
     123    { 
     124 
     125        return $this->last_name; 
     126    } 
     127 
     128    /** 
     129     * Get the [email] column value. 
     130     * E-Mail Address 
     131     * @return string 
     132     */ 
     133    public function getEmail() 
     134    { 
     135 
     136        return $this->email; 
     137    } 
     138 
     139    /** 
     140     * Get the [age] column value. 
     141     * The authors age 
     142     * @return int 
     143     */ 
     144    public function getAge() 
     145    { 
     146 
     147        return $this->age; 
     148    } 
     149 
     150    /** 
     151     * Set the value of [id] column. 
     152     * Author Id 
     153     * @param int $v new value 
     154     * @return void 
     155     */ 
    71156    public function setId($v) 
    72157    { 
     158 
    73159        if ($this->id !== $v) { 
    74160            $this->id = $v; 
     
    76162        } 
    77163 
    78           // update associated Book 
    79           if ($this->collBooks !== null) { 
    80               for ($i=0,$size=count($this->collBooks); $i < $size; $i++) { 
    81                   $this->collBooks[$i]->setAuthorId($v); 
    82               } 
    83           } 
    84  
    85     } 
    86  
    87     /** 
    88      * Get the FirstName column value. 
    89      * First Name    * @return string    */ 
    90     public function getFirstName() 
    91     { 
    92         return $this->first_name; 
    93     } 
    94  
    95  
    96     /** 
    97      * Set the value of `first_name` column. 
    98      * First Name    * @param string $v new value 
    99      * @return void 
    100      *   */ 
     164    } // setId() 
     165 
     166    /** 
     167     * Set the value of [first_name] column. 
     168     * First Name 
     169     * @param string $v new value 
     170     * @return void 
     171     */ 
    101172    public function setFirstName($v) 
    102173    { 
     174 
    103175        if ($this->first_name !== $v) { 
    104176            $this->first_name = $v; 
     
    106178        } 
    107179 
    108     } 
    109  
    110     /** 
    111      * Get the LastName column value. 
    112      * Last Name     * @return string    */ 
    113     public function getLastName() 
    114     { 
    115         return $this->last_name; 
    116     } 
    117  
    118  
    119     /** 
    120      * Set the value of `last_name` column. 
    121      * Last Name     * @param string $v new value 
    122      * @return void 
    123      *   */ 
     180    } // setFirstName() 
     181 
     182    /** 
     183     * Set the value of [last_name] column. 
     184     * Last Name 
     185     * @param string $v new value 
     186     * @return void 
     187     */ 
    124188    public function setLastName($v) 
    125189    { 
     190 
    126191        if ($this->last_name !== $v) { 
    127192            $this->last_name = $v; 
     
    129194        } 
    130195 
    131     } 
    132  
    133     /** 
    134      * Get the Email column value. 
    135      * E-Mail Address    * @return string    */ 
    136     public function getEmail() 
    137     { 
    138         return $this->email; 
    139     } 
    140  
    141  
    142     /** 
    143      * Set the value of `email` column. 
    144      * E-Mail Address    * @param string $v new value 
    145      * @return void 
    146      *   */ 
     196    } // setLastName() 
     197 
     198    /** 
     199     * Set the value of [email] column. 
     200     * E-Mail Address 
     201     * @param string $v new value 
     202     * @return void 
     203     */ 
    147204    public function setEmail($v) 
    148205    { 
     206 
    149207        if ($this->email !== $v) { 
    150208            $this->email = $v; 
     
    152210        } 
    153211 
    154     } 
    155  
    156     /** 
    157      * Get the Age column value. 
    158      * The authors age   * @return int   */ 
    159     public function getAge() 
    160     { 
    161         return $this->age; 
    162     } 
    163  
    164  
    165     /** 
    166      * Set the value of `age` column. 
    167      * The authors age   * @param int $v new value 
    168      * @return void 
    169      *   */ 
     212    } // setEmail() 
     213 
     214    /** 
     215     * Set the value of [age] column. 
     216     * The authors age 
     217     * @param int $v new value 
     218     * @return void 
     219     */ 
    170220    public function setAge($v) 
    171221    { 
     222 
    172223        if ($this->age !== $v) { 
    173224            $this->age = $v; 
     
    175226        } 
    176227 
    177     } 
    178  
    179  
     228    } // setAge() 
    180229 
    181230    /** 
     
    195244    { 
    196245        try { 
     246 
    197247            $this->id = $rs->getInt($startcol + 0); 
     248 
    198249            $this->first_name = $rs->getString($startcol + 1); 
     250 
    199251            $this->last_name = $rs->getString($startcol + 2); 
     252 
    200253            $this->email = $rs->getString($startcol + 3); 
     254 
    201255            $this->age = $rs->getInt($startcol + 4); 
     256 
    202257            $this->resetModified(); 
     258 
    203259            $this->setNew(false); 
    204260 
    205             return $startcol + 5; 
     261            // FIXME - using NUM_COLUMNS may be clearer. 
     262            return $startcol + 5; // 5 = AuthorPeer::NUM_COLUMNS - AuthorPeer::NUM_LAZY_LOAD_COLUMNS). 
    206263 
    207264        } catch (Exception $e) { 
    208265            throw new PropelException("Error populating Author object", $e); 
    209266        } 
    210  
    211     } 
    212  
    213     /** 
    214      * Builds a Criteria object containing the primary key for this object. 
    215      * 
    216      * Unlike buildCriteria() this method includes the primary key values regardless 
    217      * of whether or not they have been modified. 
    218      * 
    219      * @return Criteria The Criteria object containing value(s) for primary key(s). 
    220      */ 
    221     public function buildPkeyCriteria() 
     267    } 
     268 
     269    /** 
     270     * Removes this object from datastore and sets delete attribute. 
     271     * 
     272     * @param Connection $con 
     273     * @return void 
     274     * @throws PropelException 
     275     * @see BaseObject::setDeleted() 
     276     * @see BaseObject::isDeleted() 
     277     */ 
     278    public function delete($con = null) 
     279    { 
     280        if ($this->isDeleted()) { 
     281            throw new PropelException("This object has already been deleted."); 
     282        } 
     283 
     284        if ($con === null) { 
     285            $con = Propel::getConnection(AuthorPeer::DATABASE_NAME); 
     286        } 
     287 
     288        try { 
     289            $con->begin(); 
     290            AuthorPeer::doDelete($this, $con); 
     291            $this->setDeleted(true); 
     292            $con->commit(); 
     293        } catch (PropelException $e) { 
     294            $con->rollback(); 
     295            throw $e; 
     296        } 
     297    } 
     298 
     299    /** 
     300     * Stores the object in the database.  If the object is new, 
     301     * it inserts it; otherwise an update is performed.  This method 
     302     * wraps the doSave() worker method in a transaction. 
     303     * 
     304     * @param Connection $con 
     305     * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. 
     306     * @throws PropelException 
     307     * @see doSave() 
     308     */ 
     309    public function save($con = null) 
     310    { 
     311        if ($this->isDeleted()) { 
     312            throw new PropelException("You cannot save an object that has been deleted."); 
     313        } 
     314 
     315        if ($con === null) { 
     316            $con = Propel::getConnection(AuthorPeer::DATABASE_NAME); 
     317        } 
     318         
     319        try { 
     320            $con->begin(); 
     321            $affectedRows = $this->doSave($con); 
     322            $con->commit(); 
     323            return $affectedRows; 
     324        } catch (PropelException $e) { 
     325            $con->rollback(); 
     326            throw $e; 
     327        } 
     328    } 
     329 
     330    /** 
     331     * Stores the object in the database. 
     332     *  
     333     * If the object is new, it inserts it; otherwise an update is performed. 
     334     * All related objects are also updated in this method. 
     335     * 
     336     * @param Connection $con 
     337     * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. 
     338     * @throws PropelException 
     339     * @see save() 
     340     */ 
     341    protected function doSave($con) 
     342    { 
     343        $affectedRows = 0; // initialize var to track total num of affected rows     
     344        if (!$this->alreadyInSave) { 
     345            $this->alreadyInSave = true; 
     346     
     347 
     348            // If this object has been modified, then save it to the database. 
     349            if ($this->isModified()) { 
     350                if ($this->isNew()) { 
     351                    $pk = AuthorPeer::doInsert($this, $con); 
     352                    $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which  
     353                                         // should always be true here (even though technically  
     354                                         // BasePeer::doInsert() can insert multiple rows). 
     355 
     356                    $this->setId($pk);  //[IMV] update autoincrement primary key 
     357 
     358                    $this->setNew(false); 
     359                } else { 
     360                    $affectedRows += AuthorPeer::doUpdate($this, $con); 
     361                } 
     362                $this->resetModified(); // [HL] After being saved an object is no longer 'modified' 
     363            } 
     364 
     365            if ($this->collBooks !== null) { 
     366                foreach($this->collBooks as $referrerFK) { 
     367                    if (!$referrerFK->isDeleted()) { 
     368                        $affectedRows += $referrerFK->save($con); 
     369                    } 
     370                } 
     371            } 
     372 
     373            $this->alreadyInSave = false; 
     374        } 
     375        return $affectedRows; 
     376    } // doSave() 
     377 
     378    /** 
     379     * Validates the objects modified field values and all objects related to this table. 
     380     * 
     381     * If $columns is either a column name or an array of column names 
     382     * only those columns are validated. 
     383     * 
     384     * @param mixed $columns Column name or an array of column names. 
     385     * 
     386     * @return mixed <code>true</code> if all columns pass validation 
     387     *            or an array of <code>ValidationFailed</code> objects for columns that fail. 
     388     * @see doValidate() 
     389     */ 
     390    public function validate($columns = null) 
     391    { 
     392      if ($columns) { 
     393        return AuthorPeer::doValidate($this, $columns); 
     394      } 
     395        return $this->doValidate(); 
     396    } 
     397 
     398    /** 
     399     * This function performs the validation work for complex object models. 
     400     * 
     401     * In addition to checking the current object, all related objects will 
     402     * also be validated.  If all pass then <code>true</code> is returned; otherwise 
     403     * an aggreagated array of ValidationFailed objects will be returned. 
     404     * 
     405     * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. 
     406     */ 
     407    protected function doValidate()