Permalink
Browse files

Removed all peer stuff.

Adjusted documentation, .xml etc.
Abstracted connection handling, so we don't deal with PDOStatement directly anymore, but with DataFetcher, which hides the adapter specific stuff. (PDOStatement etc.)
Abstracted OM build process, so the platform overwrite which OM Build class we use. (`getBuilderClass()`)
Made populateObjects name-indexed compatible.
  • Loading branch information...
1 parent a8410e4 commit a4e889e7f3cda6f93f9c1b320a2ba272cfac8c3d @marcj marcj committed with willdurand Apr 15, 2013
Showing with 4,554 additions and 4,828 deletions.
  1. +3 −3 UPDATE.md
  2. +2 −2 documentation/behaviors/alternative-coding-standards.markdown
  3. +1 −1 documentation/behaviors/nested-set.markdown
  4. +3 −3 documentation/behaviors/sortable.markdown
  5. +5 −5 documentation/behaviors/versionable.markdown
  6. +0 −17 documentation/cookbook/multi-component-data-model.markdown
  7. +1 −1 documentation/cookbook/namespaces.markdown
  8. +6 −6 documentation/cookbook/replication.markdown
  9. +3 −3 documentation/cookbook/runtime-introspection.markdown
  10. +2 −2 documentation/cookbook/working-with-advanced-column-types.markdown
  11. +2 −2 documentation/cookbook/writing-behavior.markdown
  12. +4 −4 documentation/documentation/02-buildtime.markdown
  13. +1 −1 documentation/documentation/03-basic-crud.markdown
  14. +13 −13 documentation/documentation/06-transactions.markdown
  15. +7 −8 documentation/documentation/07-behaviors.markdown
  16. +7 −7 documentation/documentation/08-logging.markdown
  17. +1 −1 documentation/documentation/09-inheritance.markdown
  18. +6 −6 documentation/documentation/whats-new.markdown
  19. +13 −13 documentation/reference/active-record.markdown
  20. +1 −3 documentation/reference/buildtime-configuration.markdown
  21. +1 −1 documentation/reference/model-criteria.markdown
  22. +2 −6 documentation/reference/schema.markdown
  23. +1 −3 resources/dtd/database.dtd
  24. +2 −16 resources/xsd/database.xsd
  25. +6 −6 src/Propel/Generator/Behavior/AggregateColumn/templates/objectCompute.php
  26. +3 −3 src/Propel/Generator/Behavior/AggregateColumn/templates/objectUpdate.php
  27. +7 −7 src/Propel/Generator/Behavior/AggregateColumn/templates/objectUpdateRelated.php
  28. +4 −4 src/Propel/Generator/Behavior/AggregateColumn/templates/queryFindRelated.php
  29. +4 −4 src/Propel/Generator/Behavior/AggregateColumn/templates/queryUpdateRelated.php
  30. +1 −1 src/Propel/Generator/Behavior/Archivable/templates/queryUpdateWithoutArchive.php
  31. +0 −2 src/Propel/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceBehavior.php
  32. +3 −5 src/Propel/Generator/Behavior/NestedSet/NestedSetBehaviorObjectBuilderModifier.php
  33. +16 −25 src/Propel/Generator/Behavior/NestedSet/NestedSetBehaviorQueryBuilderModifier.php
  34. +10 −8 src/Propel/Generator/Behavior/QueryCache/QueryCacheBehavior.php
  35. +0 −10 src/Propel/Generator/Behavior/Sortable/SortableBehavior.php
  36. +8 −13 src/Propel/Generator/Behavior/Sortable/SortableBehaviorObjectBuilderModifier.php
  37. +0 −346 src/Propel/Generator/Behavior/Sortable/SortableBehaviorPeerBuilderModifier.php
  38. +192 −2 src/Propel/Generator/Behavior/Sortable/SortableBehaviorQueryBuilderModifier.php
  39. +1 −1 src/Propel/Generator/Behavior/Sortable/SortableBehaviorTableMapBuilderModifier.php
  40. +0 −2 src/Propel/Generator/Behavior/Versionable/VersionableBehavior.php
  41. +1 −68 src/Propel/Generator/Builder/DataModelBuilder.php
  42. +11 −38 src/Propel/Generator/Builder/Om/AbstractOMBuilder.php
  43. +4 −4 src/Propel/Generator/Builder/Om/AbstractObjectBuilder.php
  44. +0 −262 src/Propel/Generator/Builder/Om/AbstractPeerBuilder.php
  45. +0 −14 src/Propel/Generator/Builder/Om/ClassTools.php
  46. +0 −95 src/Propel/Generator/Builder/Om/ExtensionPeerBuilder.php
  47. +1 −2 src/Propel/Generator/Builder/Om/MultiExtendObjectBuilder.php
  48. +63 −140 src/Propel/Generator/Builder/Om/ObjectBuilder.php
  49. +0 −1,097 src/Propel/Generator/Builder/Om/PeerBuilder.php
  50. +365 −13 src/Propel/Generator/Builder/Om/QueryBuilder.php
  51. +2 −3 src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php
  52. +607 −22 src/Propel/Generator/Builder/Om/TableMapBuilder.php
  53. +1 −1 src/Propel/Generator/Builder/Om/templates/baseObjectMethods.php
  54. +1 −6 src/Propel/Generator/Builder/Om/templates/tableMapConstants.php
  55. +4 −0 src/Propel/Generator/Builder/Om/templates/tableMapInstancePool.php
  56. +11 −6 src/Propel/Generator/Command/MigrationDiffCommand.php
  57. +0 −10 src/Propel/Generator/Command/ModelBuildCommand.php
  58. +9 −0 src/Propel/Generator/Command/SqlBuildCommand.php
  59. +2 −0 src/Propel/Generator/Command/SqlInsertCommand.php
  60. +4 −1 src/Propel/Generator/Command/TestPrepareCommand.php
  61. +13 −7 src/Propel/Generator/Config/GeneratorConfig.php
  62. +0 −2 src/Propel/Generator/Config/QuickGeneratorConfig.php
  63. +6 −2 src/Propel/Generator/Manager/MigrationManager.php
  64. +4 −4 src/Propel/Generator/Manager/ModelManager.php
  65. +0 −12 src/Propel/Generator/Model/Behavior.php
  66. +12 −12 src/Propel/Generator/Model/Column.php
  67. +0 −28 src/Propel/Generator/Model/Database.php
  68. +3 −37 src/Propel/Generator/Model/Table.php
  69. +23 −0 src/Propel/Generator/Platform/DefaultPlatform.php
  70. +2 −3 src/Propel/Generator/Platform/OraclePlatform.php
  71. +2 −3 src/Propel/Generator/Platform/PgsqlPlatform.php
  72. +1 −1 src/Propel/Generator/Reverse/AbstractSchemaParser.php
  73. +10 −10 src/Propel/Generator/Reverse/MssqlSchemaParser.php
  74. +4 −4 src/Propel/Generator/Reverse/MysqlSchemaParser.php
  75. +2 −2 src/Propel/Generator/Reverse/SqliteSchemaParser.php
  76. +25 −3 src/Propel/Generator/Util/QuickBuilder.php
  77. +241 −0 src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php
  78. +704 −18 src/Propel/Runtime/ActiveQuery/Criteria.php
  79. +9 −0 src/Propel/Runtime/ActiveQuery/Criterion/AbstractCriterion.php
  80. +19 −18 src/Propel/Runtime/ActiveQuery/InstancePoolTrait.php
  81. +171 −394 src/Propel/Runtime/ActiveQuery/ModelCriteria.php
  82. +0 −13 src/Propel/Runtime/ActiveQuery/ModelWith.php
  83. +3 −1 src/Propel/Runtime/Adapter/AdapterFactory.php
  84. +2 −117 src/Propel/Runtime/Adapter/AdapterInterface.php
  85. +2 −2 src/Propel/Runtime/Adapter/Pdo/MssqlAdapter.php
  86. +2 −2 src/Propel/Runtime/Adapter/Pdo/MysqlAdapter.php
  87. +5 −8 src/Propel/Runtime/Adapter/Pdo/OracleAdapter.php
  88. +34 −33 src/Propel/Runtime/Adapter/Pdo/PdoAdapter.php
  89. +5 −8 src/Propel/Runtime/Adapter/Pdo/PgsqlAdapter.php
  90. +2 −2 src/Propel/Runtime/Adapter/Pdo/SqliteAdapter.php
  91. +2 −2 src/Propel/Runtime/Adapter/Pdo/SqlsrvAdapter.php
  92. +135 −0 src/Propel/Runtime/Adapter/SqlAdapterInterface.php
  93. +10 −0 src/Propel/Runtime/Collection/ArrayCollection.php
  94. +0 −16 src/Propel/Runtime/Collection/Collection.php
  95. +5 −5 src/Propel/Runtime/Collection/OnDemandCollection.php
  96. +12 −12 src/Propel/Runtime/Collection/OnDemandIterator.php
  97. +7 −5 src/Propel/Runtime/Connection/ConnectionFactory.php
  98. +14 −61 src/Propel/Runtime/Connection/ConnectionInterface.php
  99. +1 −1 src/Propel/Runtime/Connection/ConnectionManagerMasterSlave.php
  100. +1 −1 src/Propel/Runtime/Connection/ConnectionManagerSingle.php
  101. +17 −1 src/Propel/Runtime/Connection/ConnectionWrapper.php
  102. +113 −0 src/Propel/Runtime/Connection/PdoConnection.php
  103. +82 −0 src/Propel/Runtime/Connection/SqlConnectionInterface.php
  104. +50 −0 src/Propel/Runtime/DataFetcher/AbstractDataFetcher.php
  105. +104 −0 src/Propel/Runtime/DataFetcher/ArrayDataFetcher.php
  106. +103 −0 src/Propel/Runtime/DataFetcher/DataFetcherInterface.php
  107. +122 −0 src/Propel/Runtime/DataFetcher/PDODataFetcher.php
  108. +40 −24 src/Propel/Runtime/Formatter/AbstractFormatter.php
  109. +37 −15 src/Propel/Runtime/Formatter/ArrayFormatter.php
  110. +36 −15 src/Propel/Runtime/Formatter/ObjectFormatter.php
  111. +19 −10 src/Propel/Runtime/Formatter/OnDemandFormatter.php
  112. +19 −7 src/Propel/Runtime/Formatter/SimpleArrayFormatter.php
  113. +17 −5 src/Propel/Runtime/Formatter/StatementFormatter.php
  114. +171 −13 src/Propel/Runtime/Map/TableMap.php
  115. +15 −0 src/Propel/Runtime/Map/TableMapTrait.php
  116. +1 −1 src/Propel/Runtime/Propel.php
  117. +27 −7 src/Propel/Runtime/ServiceContainer/StandardServiceContainer.php
  118. +0 −805 src/Propel/Runtime/Util/BasePeer.php
  119. +1 −1 tests/Fixtures/etc/lob/tin_drum.txt
  120. +7 −10 tests/Propel/Tests/BookstoreTest.php
  121. +4 −6 tests/Propel/Tests/FieldnameRelatedTest.php
  122. +2 −2 tests/Propel/Tests/Generator/Behavior/AggregateColumn/AggregateColumnBehaviorTest.php
  123. +1 −2 tests/Propel/Tests/Generator/Behavior/AggregateColumn/AggregateColumnBehaviorWithSchemaTest.php
  124. +1 −0 tests/Propel/Tests/Generator/Behavior/Archivable/ArchivableBehaviorObjectBuilderModifierTest.php
  125. +11 −11 tests/Propel/Tests/Generator/Behavior/Archivable/ArchivableBehaviorTest.php
  126. +6 −6 tests/Propel/Tests/Generator/Behavior/AutoAddPk/AutoAddPkBehaviorTest.php
  127. +11 −25 tests/Propel/Tests/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceBehaviorTest.php
  128. +2 −2 ...Propel/Tests/Generator/Behavior/ConcreteInheritance/ConcreteInheritanceBehaviorWithSchemaTest.php
  129. +1 −1 tests/Propel/Tests/Generator/Behavior/Delegate/DelegateBehaviorTest.php
  130. +7 −8 tests/Propel/Tests/Generator/Behavior/I18n/I18nBehaviorQueryBuilderModifierTest.php
  131. +1 −1 tests/Propel/Tests/Generator/Behavior/I18n/I18nBehaviorTest.php
  132. +7 −7 tests/Propel/Tests/Generator/Behavior/NestedSet/NestedSetBehaviorObjectBuilderModifierTest.php
  133. +2 −10 ...Propel/Tests/Generator/Behavior/NestedSet/NestedSetBehaviorObjectBuilderModifierWithScopeTest.php
  134. +1 −1 tests/Propel/Tests/Generator/Behavior/NestedSet/NestedSetBehaviorQueryBuilderModifierTest.php
  135. +1 −1 .../Propel/Tests/Generator/Behavior/NestedSet/NestedSetBehaviorQueryBuilderModifierWithScopeTest.php
  136. +2 −2 tests/Propel/Tests/Generator/Behavior/NestedSet/NestedSetBehaviorTest.php
  137. +2 −3 tests/Propel/Tests/Generator/Behavior/NestedSet/TestCase.php
  138. +0 −3 tests/Propel/Tests/Generator/Behavior/ObjectBehaviorTest.php
  139. +0 −59 tests/Propel/Tests/Generator/Behavior/PeerBehaviorTest.php
  140. +57 −0 tests/Propel/Tests/Generator/Behavior/QueryBehaviorTest.php
  141. +4 −4 tests/Propel/Tests/Generator/Behavior/Sluggable/SluggableBehaviorTest.php
  142. +24 −25 tests/Propel/Tests/Generator/Behavior/Sortable/SortableBehaviorObjectBuilderModifierTest.php
  143. +32 −33 ...s/Propel/Tests/Generator/Behavior/Sortable/SortableBehaviorObjectBuilderModifierWithScopeTest.php
  144. +11 −11 ...{SortableBehaviorPeerBuilderModifierTest.php → SortableBehaviorQueryUtilsBuilderModifierTest.php}
  145. +20 −20 ...eerBuilderModifierWithScopeTest.php → SortableBehaviorQueryUtilsBuilderModifierWithScopeTest.php}
  146. +2 −2 tests/Propel/Tests/Generator/Behavior/Sortable/SortableBehaviorTest.php
  147. +2 −2 tests/Propel/Tests/Generator/Behavior/Sortable/TestCase.php
  148. +2 −2 tests/Propel/Tests/Generator/Behavior/TableBehaviorTest.php
  149. +4 −4 tests/Propel/Tests/Generator/Behavior/Timestampable/TimestampableBehaviorTest.php
  150. +1 −1 tests/Propel/Tests/Generator/Builder/NamespaceTest.php
  151. +1 −2 tests/Propel/Tests/Generator/Builder/Om/GeneratedObjectArrayColumnTypeTest.php
  152. +0 −2 tests/Propel/Tests/Generator/Builder/Om/GeneratedObjectLobTest.php
  153. +0 −3 tests/Propel/Tests/Generator/Builder/Om/GeneratedObjectRelTest.php
  154. +4 −6 tests/Propel/Tests/Generator/Builder/Om/GeneratedObjectTest.php
  155. +0 −6 tests/Propel/Tests/Generator/Builder/Om/GeneratedObjectWithFixturesTest.php
  156. +23 −26 ...ropel/Tests/Generator/Builder/Om/{GeneratedPeerDoDeleteTest.php → GeneratedQueryDoDeleteTest.php}
  157. +19 −28 ...ropel/Tests/Generator/Builder/Om/{GeneratedPeerDoSelectTest.php → GeneratedQueryDoSelectTest.php}
  158. +3 −3 ...erator/Builder/Om/{GeneratedPeerEnumColumnTypeTest.php → GeneratedTableMapEnumColumnTypeTest.php}
  159. +6 −6 ...el/Tests/Generator/Builder/Om/{GeneratedPeerLazyLoadTest.php → GeneratedTableMapLazyLoadTest.php}
  160. +8 −11 tests/Propel/Tests/Generator/Builder/Om/{GeneratedPeerTest.php → GeneratedTableMapTest.php}
  161. +2 −2 tests/Propel/Tests/Generator/Builder/Om/QueryBuilderInheritanceTest.php
  162. +8 −11 tests/Propel/Tests/Generator/Builder/Om/QueryBuilderTest.php
  163. +4 −4 tests/Propel/Tests/Generator/Model/ColumnTest.php
  164. +0 −4 tests/Propel/Tests/Generator/Model/DatabaseTest.php
  165. +0 −10 tests/Propel/Tests/Generator/Model/TableTest.php
  166. +3 −7 tests/Propel/Tests/Generator/Util/QuickBuilderTest.php
  167. +5 −21 tests/Propel/Tests/Helpers/Bookstore/Behavior/Testallhooksbehavior.php
  168. +1 −41 tests/Propel/Tests/Helpers/Bookstore/BookstoreDataPopulator.php
  169. +14 −14 tests/Propel/Tests/Runtime/ActiveQuery/CriteriaCombineTest.php
  170. +7 −8 tests/Propel/Tests/Runtime/ActiveQuery/CriteriaFluidOperatorTest.php
  171. +1 −2 tests/Propel/Tests/Runtime/ActiveQuery/CriteriaMergeTest.php
  172. +58 −59 tests/Propel/Tests/Runtime/ActiveQuery/CriteriaTest.php
  173. +2 −2 tests/Propel/Tests/Runtime/ActiveQuery/ModelCriteriaSelectTest.php
  174. +8 −20 tests/Propel/Tests/Runtime/ActiveQuery/ModelCriteriaTest.php
  175. +1 −1 tests/Propel/Tests/Runtime/ActiveQuery/ModelCriteriaWithNamespaceTest.php
  176. +4 −4 tests/Propel/Tests/Runtime/ActiveQuery/ModelCriteriaWithSchemaTest.php
  177. +5 −7 tests/Propel/Tests/Runtime/ActiveQuery/ModelJoinTest.php
  178. +2 −7 tests/Propel/Tests/Runtime/ActiveQuery/ModelWithTest.php
  179. +4 −5 tests/Propel/Tests/Runtime/ActiveQuery/SubQueryTest.php
  180. +9 −11 tests/Propel/Tests/Runtime/Adapter/Pdo/OracleAdapterTest.php
  181. +0 −17 tests/Propel/Tests/Runtime/Collection/CollectionTest.php
  182. +1 −1 tests/Propel/Tests/Runtime/Connection/ConnectionFactoryTest.php
  183. +2 −2 tests/Propel/Tests/Runtime/Connection/ConnectionManagerMasterSlaveTest.php
  184. +2 −2 tests/Propel/Tests/Runtime/Connection/ConnectionManagerSingleTest.php
  185. +5 −7 tests/Propel/Tests/Runtime/Connection/PropelPDOTest.php
  186. +14 −14 tests/Propel/Tests/Runtime/Formatter/ArrayFormatterTest.php
  187. +3 −6 tests/Propel/Tests/Runtime/Formatter/ArrayFormatterWithTest.php
  188. +134 −0 tests/Propel/Tests/Runtime/Formatter/DataFetcherTest.php
  189. +2 −3 tests/Propel/Tests/Runtime/Formatter/ObjectFormatterWithTest.php
  190. +1 −2 tests/Propel/Tests/Runtime/Formatter/OnDemandFormatterWithTest.php
  191. +9 −7 tests/Propel/Tests/Runtime/Formatter/StatementFormatterTest.php
  192. +5 −5 tests/Propel/Tests/Runtime/Map/ColumnMapTest.php
  193. +1 −1 tests/Propel/Tests/Runtime/Map/DatabaseMapTest.php
  194. +1 −1 tests/Propel/Tests/Runtime/ServiceContainer/StandardServiceContainerTest.php
  195. +17 −26 tests/Propel/Tests/Runtime/Util/{BasePeerExceptionsTest.php → TableMapExceptionsTest.php}
  196. +31 −33 tests/Propel/Tests/Runtime/Util/{BasePeerTest.php → TableMapTest.php}
  197. +1 −3 tools/generator/default.properties
View
@@ -40,13 +40,13 @@ The classes used by Propel internally to build the object model were renamed. Th
Replace... With...
OMBuilder.php AbstractOMBuilder.php
ObjectBuilder.php AbstractObjectBuilder.php
- PeerBuilder.php AbstractPeerBuilder.php
+ PeerBuilder.php __removed__
PHP5ExtensionObjectBuilder.php ExtensionObjectBuilder.php
- PHP5ExtensionPeerBuilder.php ExtensionPeerBuilder.php
+ PHP5ExtensionPeerBuilder.php __removed__
PHP5InterfaceBuilder.php InterfaceBuilder.php
PHP5MultiExtendObjectBuilder.php MultiExtendObjectBuilder.php
PHP5ObjectBuilder.php ObjectBuilder.php
- PHP5PeerBuilder.php PeerBuilder.php
+ PHP5PeerBuilder.php __removed__
PHP5TableMapBuilder.php TableMapBuilder.php
## Base classes reorganized
@@ -39,7 +39,7 @@ Rebuild your model, and you're ready to go. The code of the model classes now us
if ($this->title !== $v)
{
$this->title = $v;
- $this->modifiedColumns[] = BookPeer::TITLE;
+ $this->modifiedColumns[] = BookTableMap::TITLE;
}
return $this;
@@ -61,7 +61,7 @@ Rebuild your model, and you're ready to go. The code of the model classes now us
if ($this->title !== $v) {
$this->title = $v;
- $this->modifiedColumns[] = BookPeer::TITLE;
+ $this->modifiedColumns[] = BookTableMap::TITLE;
}
return $this;
@@ -342,7 +342,7 @@ $node findRoot($scope = null)
coll findTree($scope = null)
{% endhighlight %}
-Lastly, the behavior adds a few methods to the Peer classes:
+Lastly, the behavior adds a few methods to the Query classes:
{% highlight php %}
<?php
@@ -154,14 +154,14 @@ The generated methods now accept a `$scope` parameter to restrict the query to a
<?php
$firstPaulTask = TaskQuery::create()->findOneByRank($rank = 1, $scope = $paul->getId()); // $t1
$lastPaulTask = $firstTask->getNext(); // $t2
-$firstJohnTask = TaskPeer::create()->findOneByRank($rank = 1, $scope = $john->getId()); // $t1
+$firstJohnTask = TaskQuery::create()->findOneByRank($rank = 1, $scope = $john->getId()); // $t1
{% endhighlight %}
Models using the sortable behavior with scope benefit from one additional Query methods named `inList()`:
{% highlight php %}
<?php
-$allPaulsTasks = TaskPeer::create()->inList($scope = $paul->getId())->find();
+$allPaulsTasks = TaskQuery::create()->inList($scope = $paul->getId())->find();
{% endhighlight %}
## Parameters ##
@@ -258,7 +258,7 @@ bool reorder($newOrder) // $newOrder is a $id => $rank associative array
array inList($scope)
{% endhighlight %}
-The behavior also adds a few methods to the Peer classes:
+The behavior also adds a few methods to the Query classes:
{% highlight php %}
<?php
@@ -132,19 +132,19 @@ $book->setISBN('0553213105');
$book->save(): // book is saved, and a new version is created
{% endhighlight %}
-Alternatively, you can choose to disable the automated creation of a new version at each save for all objects of a given model by calling the `disableVersioning()` method on the Peer class. In this case, you still have the ability to manually create a new version of an object, using the `addVersion()` method on a saved object:
+Alternatively, you can choose to disable the automated creation of a new version at each save for all objects of a given model by calling the `disableVersioning()` method on the Query class. In this case, you still have the ability to manually create a new version of an object, using the `addVersion()` method on a saved object:
{% highlight php %}
<?php
-BookPeer::disableVersioning();
+BookQuery::disableVersioning();
$book = new Book();
$book->setTitle('Pride and Prejudice');
$book->setVersion(1);
$book->save(); // book is saved, no new version is created
$book->addVersion(); // a new version is created
-// you can reenable versioning using the Peer static method enableVersioning()
-BookPeer::enableVersioning();
+// you can reenable versioning using the Query static method enableVersioning()
+BookQuery::enableVersioning();
{% endhighlight %}
## Versioning Related objects ##
@@ -256,7 +256,7 @@ The audit log abilities need to be enabled in the schema as well:
* `BaseObject setVersionComment(string $comment)`: Defines the comment for the revision
* `string getVersionComment()`: Gets the comment for the revision
-### Peer class ###
+### Query static methods ###
* `void enableVersioning()`: Enables versionning for all instances of the related ActiveRecord class
* `void disableVersioning()`: Disables versionning for all instances of the related ActiveRecord class
@@ -101,13 +101,10 @@ build/
om/
map/
Author.php
- AuthorPeer.php
AuthorQuery.php
Book.php
- BookPeer.php
BookQuery.php
Review.php
- ReviewPeer.php
ReviewQuery.php
{% endhighlight %}
@@ -129,16 +126,13 @@ build/
om/
map/
Author.php
- AuthorPeer.php
AuthorQuery.php
book/
om/
map/
Book.php
- BookPeer.php
BookQuery.php
Review.php
- ReviewPeer.php
ReviewQuery.php
{% endhighlight %}
@@ -152,19 +146,16 @@ build/
om/
map/
Author.php
- AuthorPeer.php
AuthorQuery.php
book/
om/
map/
Book.php
- BookPeer.php
BookQuery.php
review/
om/
map/
Review.php
- ReviewPeer.php
ReviewQuery.php
{% endhighlight %}
@@ -246,29 +237,21 @@ This should run without any complaints. When you have a look at the projects/boo
addon/
club/
BookClubList.php
- BookClubListPeer.php
BookListRel.php
- BookListRelPeer.php
core/
author/
Author.php
- AuthorPeer.php
book/
Book.php
- BookPeer.php
Media.php
- MediaPeer.php
publisher/
Publisher.php
- PublisherPeer.php
review/
Review.php
- ReviewPeer.php
util/
log/
BookstoreLog.php
- BookstoreLogPeer.php
{% endhighlight %}
(The additional subdirectories map/ and om/ in each of these directories have been omitted for clarity.)
@@ -85,7 +85,7 @@ $book->setAuthor($author);
$book->save();
{% endhighlight %}
-The namespace is used for the ActiveRecord class, but also for the Query and Peer classes. Just remember that when you use relation names ina query, the namespace should not appear:
+The namespace is used for the ActiveRecord class, but also for the Query classes. Just remember that when you use relation names ina query, the namespace should not appear:
{% highlight php %}
<?php
@@ -55,7 +55,7 @@ The `<slaves>` section is at the same level as the master `<connection>` and con
## Implementation ##
-The replication functionality is implemented in the Propel connection configuration and initialization code and in the generated Peer and Object classes.
+The replication functionality is implemented in the Propel connection configuration and initialization code and in the generated TableMap and Object classes.
### `Propel::getReadConnection()` and `Propel::getWriteConnection()` ###
@@ -65,15 +65,15 @@ You can also specify that you want a READ connection (slave) or a WRITE connecti
{% highlight php %}
<?php
-$con = Propel::getReadConnection(MyPeer::DATABASE_NAME);
+$con = Propel::getReadConnection(MyTableMap::DATABASE_NAME);
$books = BookQuery::create()->find($con);
{% endhighlight %}
Other methods that are designed to perform write operations, like `ModelCriteria::update()` or `ModelCriteria::delete()`; will explicitly request a WRITE connection:
{% highlight php %}
<?php
-$con = Propel::getWriteConnection(MyPeer::DATABASE_NAME);
+$con = Propel::getWriteConnection(MyTableMap::DATABASE_NAME);
BookQuery::create()->deleteAll($con);
{% endhighlight %}
@@ -85,7 +85,7 @@ Both READ (slave) and WRITE (master) connections are only configured on demand.
{% highlight php %}
<?php
-$con = Propel::getReadConnection(MyPeer::DATABASE_NAME);
+$con = Propel::getReadConnection(MyTableMap::DATABASE_NAME);
$stmt = $con->query('SELECT * FROM my');
/* ... */
{% endhighlight %}
@@ -98,9 +98,9 @@ To do so, call the `setForceMasterConnection()` method on the related `Connectio
{% highlight php %}
<?php
-$manager = Propel::getServiceContainer()->getConnectionManager(MyPeer::DATABASE_NAME);
+$manager = Propel::getServiceContainer()->getConnectionManager(MyTableMap::DATABASE_NAME);
$manager->setForceMasterConnection(true);
-$con = Propel::getReadConnection(MyPeer::DATABASE_NAME);
+$con = Propel::getReadConnection(MyTableMap::DATABASE_NAME);
// $con is a WRITE connection
{% endhighlight %}
@@ -5,19 +5,19 @@ title: Model Introspection At Runtime
# Model Introspection At Runtime #
-In addition to the object and peer classes used to do C.R.U.D. operations, Propel generates an object mapping for your tables to allow runtime introspection.
+In addition to the object classes used to do C.R.U.D. operations, Propel generates an object mapping for your tables to allow runtime introspection.
The intospection objects are instances of the map classes. Propel maps databases, tables, columns and relations into objects that you can easily use.
## Retrieving a TableMap ##
The starting point for runtime introspection is usually a table map. This objects stores every possible property of a table, as defined in the `schema.xml`, but accessible at runtime.
-To retrieve a table map for a table, use the `getTableMap()` static method of the related peer class. For instance, to retrieve the table map for the `book` table, just call:
+To retrieve a table map for a table, use the `getTableMap()` static method of the related TableMap class. For instance, to retrieve the table map for the `book` table, just call:
{% highlight php %}
<?php
-$bookTable = BookPeer::getTableMap();
+$bookTable = BookTableMap::getTableMap();
{% endhighlight %}
## TableMap properties ##
@@ -19,7 +19,7 @@ BLOB values will be returned as PHP stream resources from the accessor methods.
{% highlight php %}
<?php
-$media = MediaPeer::retrieveByPK(1);
+$media = MediaQuery::create()->findPk(1);
$fp = $media->getCoverImage();
if ($fp !== null) {
echo stream_get_contents($fp);
@@ -62,7 +62,7 @@ For example:
{% highlight php %}
<?php
-$media = MediaPeer::retrieveByPK(1);
+$media = MediaQuery::create()->findPk(1);
$fp = $media->getCoverImage();
$media->setCoverImage($fp);
@@ -210,7 +210,7 @@ class BasePollQuestion extends BaseObject
}
{% endhighlight %}
-Behaviors offer similar hook methods to allow the addition of methods to the query classes (`queryMethods()`) and to the peer classes (`peerMethods()`). And if you need to add attributes, just implement one of the `objectAttributes()`, `queryAttributes()`, or `peerAttributes()` methods.
+Behaviors offer similar hook methods to allow the addition of methods to the query classes (`queryMethods()`) and to the object classes (`objectMethods()`). And if you need to add attributes, just implement one of the `objectAttributes()` or `queryAttributes()` methods.
## Using a Template For Generated Code ##
@@ -425,7 +425,7 @@ class BehaviorB extends Behavior
## What's Left ##
-These are the basics of behavior writing: implement one of the methods documented in the [behaviors chapter](../documentation/07-behaviors.html#writing-a-behavior) of the Propel guide, and return strings containing the code to be added to the ActiveRecord, Query, and Peer classes. In addition to the behavior code, you should always write unit tests - all the behaviors bundled with Propel have full unit test coverage. And to make your behavior usable by others, documentation is highly recommended. Once again, Propel core behaviors are fully documented, to let users understand the behavior usage without having to peek into the code.
+These are the basics of behavior writing: implement one of the methods documented in the [behaviors chapter](../documentation/07-behaviors.html#writing-a-behavior) of the Propel guide, and return strings containing the code to be added to the ActiveRecord, Query, and TableMap classes. In addition to the behavior code, you should always write unit tests - all the behaviors bundled with Propel have full unit test coverage. And to make your behavior usable by others, documentation is highly recommended. Once again, Propel core behaviors are fully documented, to let users understand the behavior usage without having to peek into the code.
As for the `AggregateColumnBehavior`, the job is not finished. The [blog post](http://propel.posterous.com/getting-to-know-propel-15-keeping-an-aggregat) emphasized the need for hooks in the Query class, and these are not yet implemented in the above code. Besides, the post kept quiet about one use case that left the aggregate column not up to date (when a question is detached from a poll without deleting it). Lastly, the parameters required for this behavior are currently a bit verbose, especially concerning the need to define the foreign table and the foreign key - this could be simplified thanks to the knowledge of the object model that behaviors have.
@@ -170,21 +170,21 @@ The "om" command added a new directory in the `bookstore/` project, called `buil
> ls
om/
map/
+ AuthorTableMap.php
+ BookTableMap.php
+ PublisherTableMap.php
Author.php
- AuthorPeer.php
AuthorQuery.php
Book.php
- BookPeer.php
BookQuery.php
Publisher.php
- PublisherPeer.php
PublisherQuery.php
{% endhighlight %}
For every table in the database, Propel creates 3 PHP classes:
* a _model_ class (e.g. `Book`), which represents a row in the database;
-* a _peer_ class (e.g. `BookPeer`), offering static constants and methods mostly for compatibility with previous Propel versions;
+* a _tablemap_ class (e.g. `Map\BookTableMap`), offering static constants and methods mostly for compatibility with previous Propel versions;
* a _query_ class (e.g. `BookQuery`), used to operate on a table to retrieve and update rows
Propel uses the `phpName` attribute of each table as the base for the PHP class names.
@@ -166,7 +166,7 @@ As Propel uses PDO to query the underlying database, you can always write custom
{% highlight php %}
<?php
use Propel\Runtime\Propel;
-$con = Propel::getConnection(BookPeer::DATABASE_NAME);
+$con = Propel::getConnection(BookTableMap::DATABASE_NAME);
$sql = "SELECT * FROM book WHERE id NOT IN "
."(SELECT book_review.book_id FROM book_review"
." INNER JOIN author ON (book_review.author_id=author.ID)"
Oops, something went wrong.

0 comments on commit a4e889e

Please sign in to comment.