Changeset 338 for trunk/examples/propel
- Timestamp:
- 09/20/05 00:31:05 (3 years ago)
- Files:
-
- trunk/examples/propel/bookstore/Author.php (modified) (2 diffs)
- trunk/examples/propel/bookstore/AuthorPeer.php (modified) (1 diff)
- trunk/examples/propel/bookstore/Book.php (modified) (2 diffs)
- trunk/examples/propel/bookstore/BookPeer.php (modified) (1 diff)
- trunk/examples/propel/bookstore/Publisher.php (modified) (2 diffs)
- trunk/examples/propel/bookstore/PublisherPeer.php (modified) (1 diff)
- trunk/examples/propel/bookstore/map/AuthorMapBuilder.php (modified) (4 diffs)
- trunk/examples/propel/bookstore/map/BookMapBuilder.php (modified) (4 diffs)
- trunk/examples/propel/bookstore/map/PublisherMapBuilder.php (modified) (4 diffs)
- trunk/examples/propel/bookstore/om/BaseAuthor.php (modified) (16 diffs)
- trunk/examples/propel/bookstore/om/BaseAuthorPeer.php (modified) (27 diffs)
- trunk/examples/propel/bookstore/om/BaseBook.php (modified) (21 diffs)
- trunk/examples/propel/bookstore/om/BaseBookPeer.php (modified) (32 diffs)
- trunk/examples/propel/bookstore/om/BasePublisher.php (modified) (16 diffs)
- trunk/examples/propel/bookstore/om/BasePublisherPeer.php (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/propel/bookstore/Author.php
r215 r338 1 1 <?php 2 2 3 require_once 'bookstore/om/BaseAuthor.php'; 3 4 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. 6 8 * 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 8 14 * 9 15 * You should add additional methods to this class to meet the … … 11 17 * long as it does not already exist in the output directory. 12 18 * 13 * @package bookstore 14 */ 19 * @package bookstore 20 */ 15 21 class Author extends BaseAuthor { 16 22 17 } 23 } // Author trunk/examples/propel/bookstore/AuthorPeer.php
r215 r338 1 1 <?php 2 // The parent class3 require_once 'bookstore/om/BaseAuthorPeer.php';4 2 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'; 7 8 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. 10 12 * 11 * [05/12/05 21:16:11]13 * Author Table 12 14 * 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: 16 16 * 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 */ 19 25 class AuthorPeer extends BaseAuthorPeer { 20 26 21 } 27 } // AuthorPeer trunk/examples/propel/bookstore/Book.php
r215 r338 1 1 <?php 2 2 3 require_once 'bookstore/om/BaseBook.php'; 3 4 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. 6 8 * 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 8 14 * 9 15 * You should add additional methods to this class to meet the … … 11 17 * long as it does not already exist in the output directory. 12 18 * 13 * @package bookstore 14 */ 19 * @package bookstore 20 */ 15 21 class Book extends BaseBook { 16 22 17 } 23 } // Book trunk/examples/propel/bookstore/BookPeer.php
r215 r338 1 1 <?php 2 // The parent class3 require_once 'bookstore/om/BaseBookPeer.php';4 2 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'; 7 8 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. 10 12 * 11 * [05/12/05 21:16:11]13 * Book Table 12 14 * 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: 16 16 * 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 */ 19 25 class BookPeer extends BaseBookPeer { 20 26 21 } 27 } // BookPeer trunk/examples/propel/bookstore/Publisher.php
r215 r338 1 1 <?php 2 2 3 require_once 'bookstore/om/BasePublisher.php'; 3 4 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. 6 8 * 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 8 14 * 9 15 * You should add additional methods to this class to meet the … … 11 17 * long as it does not already exist in the output directory. 12 18 * 13 * @package bookstore 14 */ 19 * @package bookstore 20 */ 15 21 class Publisher extends BasePublisher { 16 22 17 } 23 } // Publisher trunk/examples/propel/bookstore/PublisherPeer.php
r335 r338 1 1 <?php 2 // The parent class3 require_once 'bookstore/om/BasePublisherPeer.php';4 2 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'; 7 8 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. 10 12 * 11 * [05/12/05 21:16:11]13 * Publisher Table 12 14 * 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: 16 16 * 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 */ 19 25 class PublisherPeer extends BasePublisherPeer { 20 26 21 } 27 } // PublisherPeer trunk/examples/propel/bookstore/map/AuthorMapBuilder.php
r215 r338 1 1 <?php 2 2 3 require_once 'propel/map/MapBuilder.php'; 3 4 include_once 'creole/CreoleTypes.php'; 4 5 6 5 7 /** 6 8 * 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 * 7 15 * 8 16 * These statically-built map classes are used by Propel to do runtime db structure discovery. … … 11 19 * (i.e. if it's a text column type). 12 20 * 13 * This class was autogenerated by Propel on:14 *15 * [05/12/05 21:28:42]16 *17 * @see BasePeer18 * @see DatabaseMap19 21 * @package bookstore.map 20 */ 21 class AuthorMapBuilder implements MapBuilder{22 */ 23 class AuthorMapBuilder { 22 24 23 /**24 * Thename of this class25 */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 28 30 /** 29 31 * The database map. 30 32 */ 31 private $dbMap = null;33 private $dbMap; 32 34 33 /**35 /** 34 36 * Tells us if this DatabaseMapBuilder is built so that we 35 37 * don't have to re-build it every time. 36 38 * 37 * @return true if this DatabaseMapBuilder is built39 * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 38 40 */ 39 41 public function isBuilt() … … 42 44 } 43 45 44 /**46 /** 45 47 * Gets the databasemap this map builder built. 46 48 * … … 60 62 public function doBuild() 61 63 { 62 $this->dbMap = Propel::getDatabaseMap( "bookstore");64 $this->dbMap = Propel::getDatabaseMap('bookstore'); 63 65 64 $tMap = $this->dbMap->addTable("author"); 65 $tMap->setPhpName("Author"); 66 67 66 $tMap = $this->dbMap->addTable('author'); 67 $tMap->setPhpName('Author'); 68 68 69 $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?'); 83 88 84 } 85 } 89 } // doBuild() 90 91 } // AuthorMapBuilder trunk/examples/propel/bookstore/map/BookMapBuilder.php
r215 r338 1 1 <?php 2 2 3 require_once 'propel/map/MapBuilder.php'; 3 4 include_once 'creole/CreoleTypes.php'; 4 5 6 5 7 /** 6 8 * 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 * 7 15 * 8 16 * These statically-built map classes are used by Propel to do runtime db structure discovery. … … 11 19 * (i.e. if it's a text column type). 12 20 * 13 * This class was autogenerated by Propel on:14 *15 * [05/12/05 21:28:42]16 *17 * @see BasePeer18 * @see DatabaseMap19 21 * @package bookstore.map 20 */ 21 class BookMapBuilder implements MapBuilder{22 */ 23 class BookMapBuilder { 22 24 23 /**24 * Thename of this class25 */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 28 30 /** 29 31 * The database map. 30 32 */ 31 private $dbMap = null;33 private $dbMap; 32 34 33 /**35 /** 34 36 * Tells us if this DatabaseMapBuilder is built so that we 35 37 * don't have to re-build it every time. 36 38 * 37 * @return true if this DatabaseMapBuilder is built39 * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 38 40 */ 39 41 public function isBuilt() … … 42 44 } 43 45 44 /**46 /** 45 47 * Gets the databasemap this map builder built. 46 48 * … … 60 62 public function doBuild() 61 63 { 62 $this->dbMap = Propel::getDatabaseMap( "bookstore");64 $this->dbMap = Propel::getDatabaseMap('bookstore'); 63 65 64 $tMap = $this->dbMap->addTable("book"); 65 $tMap->setPhpName("Book"); 66 67 66 $tMap = $this->dbMap->addTable('book'); 67 $tMap->setPhpName('Book'); 68 68 69 $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.'); 83 88 84 } 85 } 89 } // doBuild() 90 91 } // BookMapBuilder trunk/examples/propel/bookstore/map/PublisherMapBuilder.php
r215 r338 1 1 <?php 2 2 3 require_once 'propel/map/MapBuilder.php'; 3 4 include_once 'creole/CreoleTypes.php'; 4 5 6 5 7 /** 6 8 * 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 * 7 15 * 8 16 * These statically-built map classes are used by Propel to do runtime db structure discovery. … … 11 19 * (i.e. if it's a text column type). 12 20 * 13 * This class was autogenerated by Propel on:14 *15 * [05/12/05 21:28:42]16 *17 * @see BasePeer18 * @see DatabaseMap19 21 * @package bookstore.map 20 */ 21 class PublisherMapBuilder implements MapBuilder{22 */ 23 class PublisherMapBuilder { 22 24 23 /**24 * Thename of this class25 */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 28 30 /** 29 31 * The database map. 30 32 */ 31 private $dbMap = null;33 private $dbMap; 32 34 33 /**35 /** 34 36 * Tells us if this DatabaseMapBuilder is built so that we 35 37 * don't have to re-build it every time. 36 38 * 37 * @return true if this DatabaseMapBuilder is built39 * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 38 40 */ 39 41 public function isBuilt() … … 42 44 } 43 45 44 /**46 /** 45 47 * Gets the databasemap this map builder built. 46 48 * … … 60 62 public function doBuild() 61 63 { 62 $this->dbMap = Propel::getDatabaseMap( "bookstore");64 $this->dbMap = Propel::getDatabaseMap('bookstore'); 63 65 64 $tMap = $this->dbMap->addTable("publisher"); 65 $tMap->setPhpName("Publisher"); 66 67 66 $tMap = $this->dbMap->addTable('publisher'); 67 $tMap->setPhpName('Publisher'); 68 68 69 $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); 76 74 77 } 78 } 75 } // doBuild() 76 77 } // PublisherMapBuilder trunk/examples/propel/bookstore/om/BaseAuthor.php
r215 r338 1 1 <?php 2 2 3 require_once 'propel/om/BaseObject.php'; 3 4 … … 12 13 * Base class that represents a row from the 'author' table. 13 14 * 14 * Author Table * 15 * Author Table 16 * 15 17 * This class was autogenerated by Propel on: 16 18 * 17 * [05/12/05 21:28:42]19 * 09/19/05 20:42:23 18 20 * 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 */ 23 abstract class BaseAuthor extends BaseObject implements Persistent { 24 24 25 25 26 /** … … 31 32 protected static $peer; 32 33 34 33 35 /** 34 36 * The value for the id field. 35 * @var int */ 37 * @var int 38 */ 36 39 protected $id; 37 40 41 38 42 /** 39 43 * The value for the first_name field. 40 * @var string */ 44 * @var string 45 */ 41 46 protected $first_name; 42 47 48 43 49 /** 44 50 * The value for the last_name field. 45 * @var string */ 51 * @var string 52 */ 46 53 protected $last_name; 47 54 55 48 56 /** 49 57 * The value for the email field. 50 * @var string */ 58 * @var string 59 */ 51 60 protected $email; 52 61 62 53 63 /** 54 64 * The value for the age field. 55 * @var int */ 65 * @var int 66 */ 56 67 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 */ 60 100 public function getId() 61 101 { 102 62 103 return $this->id; 63 104 } 64 105 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 */ 71 156 public function setId($v) 72 157 { 158 73 159 if ($this->id !== $v) { 74 160 $this->id = $v; … … 76 162 } 77 163 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 */ 101 172 public function setFirstName($v) 102 173 { 174 103 175 if ($this->first_name !== $v) { 104 176 $this->first_name = $v; … … 106 178 } 107 179 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 */ 124 188 public function setLastName($v) 125 189 { 190 126 191 if ($this->last_name !== $v) { 127 192 $this->last_name = $v; … … 129 194 } 130 195 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 */ 147 204 public function setEmail($v) 148 205 { 206 149 207 if ($this->email !== $v) { 150 208 $this->email = $v; … … 152 210 } 153 211 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 */ 170 220 public function setAge($v) 171 221 { 222 172 223 if ($this->age !== $v) { 173 224 $this->age = $v; … … 175 226 } 176 227 177 } 178 179 228 } // setAge() 180 229 181 230 /** … … 195 244 { 196 245 try { 246 197 247 $this->id = $rs->getInt($startcol + 0); 248 198 249 $this->first_name = $rs->getString($startcol + 1); 250 199 251 $this->last_name = $rs->getString($startcol + 2); 252 200 253 $this->email = $rs->getString($startcol + 3); 254 201 255 $this->age = $rs->getInt($startcol + 4); 256 202 257 $this->resetModified(); 258 203 259 $this->setNew(false); 204 260 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). 206 263 207 264 } catch (Exception $e) { 208 265 throw new PropelException("Error populating Author object", $e); 209 266 } 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()
