Buildtime-Configuration.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. = Build Properties Reference =
  2. [[PageOutline]]
  3. Here is a list of properties that can be set to affect how Propel builds database files. For a complete list, see the {{{default.properties}}} file that is bundled with your version of Propel generator (this will be in PEAR's data directory if you are using a PEAR-installed version of Propel).
  4. First, some conventions:
  5. * Text surrounded by a '''/''' is text that you would provide and is not defined in the language. (i.e. a table name is a good example of this.)
  6. * Items where you have an alternative choice have a '''|''' character between them (i.e. true|false)
  7. * Alternative choices may be delimited by '''{''' and '''}''' to indicate that this is the default option, if not overridden elsewhere.
  8. == Where to Specify Properties ==
  9. === In the Project build.properties File ===
  10. The most natural place to specify properties for a file are in the project's {{{build.properties}}} file. This file is expected to be found in the project directory.
  11. === In a global build.properties file ===
  12. You can also create a {{{global build.properties}}} file in the same directory as Propel's {{{default.properties}}} file. For users who have installed Propel using PEAR, this will be in PEAR data directory structure.
  13. === On the Command Line ===
  14. You can also specify properties on the commandline when you invoke Propel:
  15. {{{
  16. $ propel-gen /path/to/project -Dpropel.someOtherProperty=value
  17. }}}
  18. ''Note that there is '''no space''' between the -D and the property name.''
  19. == The Properties ==
  20. === General Build Settings ===
  21. {{{
  22. propel.project = Your-Project-Name
  23. }}}
  24. The name of your project. This affects names of generated files, etc.
  25. {{{
  26. propel.targetPackage = {propel.project}
  27. }}}
  28. The package to use for the generated classes. This affects the value of the @package phpdoc tag, and it also affects the directory that the classes are placed in. By default this will be the same as the project. Note that the target package (and thus the target directory for generated classes) can be overridden in each `<database>` and `<table>` element in the XML schema.
  29. {{{
  30. propel.packageObjectModel = true|{false}
  31. }}}
  32. Whether to join schemas using the same database name into a single schema. This allows splitting schemas in packages, and referencing tables in another schema (but in the same database) in a foreign key. Beware that database behaviors will also be joined when this parameter is set to true.
  33. {{{
  34. propel.schema.validate = {true}|false
  35. }}}
  36. Whether to validate the schema using the XSD file. The default XSD file is located under `generator/resources/xsd/database.xsd`, and you can use a custom XSD file by changing the `propel.schema.xsd.file` property.
  37. {{{
  38. propel.schema.transform = true|{false}
  39. }}}
  40. Whether to transform the schema using the XSL file. This was used in previous Propel versions to clean up the schema, but tended to hide problems in the schema. It is disabled by default since Propel 1.5. The default XSL file is located under `generator/resources/xsd/database.xsl`, and you can use a custom XSL file by changing the `propel.schema.xsl.file` property.
  41. === Database Settings ===
  42. {{{
  43. propel.database = pgsql|mysql|sqlite|mssql|oracle
  44. }}}
  45. The Propel platform that will be used to determine how to build the SQL DDL, etc.
  46. {{{
  47. propel.database.url = /PDO database connection string/
  48. propel.database.user =
  49. propel.database.password =
  50. }}}
  51. Propel will use this information as the default to connect to your database. Note that for PDO some drivers (e.g. mysql, oracle) require that you specify the username and password separately from the DSN, which is why they are available as options.
  52. {{{
  53. propel.database.buildUrl = /PDO database connection string, defaults to use ${propel.database.url}/
  54. }}}
  55. This property is used by Propel to connect to a database to reverse engineer or data dump. The default is to use the database connection defined by the ''propel.database.url'' property.
  56. {{{
  57. propel.database.createUrl = /PDO database connection string, defaults to use ${propel.database.url}/
  58. }}}
  59. This property is used by Propel for creating a database. Of course, Propel is unable to create many databases because they do not provide a SQL method for creation; therefore, it is usually recommended that you actually create your database by hand.
  60. {{{
  61. propel.database.schema = /schema-name/
  62. }}}
  63. Where supported by the RDBMS, you can specify a schema name for Propel to use.
  64. {{{
  65. propel.database.encoding =
  66. }}}
  67. The encoding to use for the database. This can affect things such as transforming charsets when exporting to XML, etc.
  68. {{{
  69. propel.tablePrefix = {empty}|string
  70. }}}
  71. Add a prefix to all the table names in the database. This does not affect the tables phpName. This setting can be overridden on a per-database basis in the schema.
  72. === Reverse-Engineering Settings ===
  73. {{{
  74. propel.samePhpName = true|{false}
  75. }}}
  76. Whether to specify PHP names that are the same as the column names.
  77. {{{
  78. propel.addVendorInfo = true|{false}
  79. }}}
  80. Whether to add the vendor info. This is currently only used for MySQL, but does provide additional information (such as full-text indexes) which can affect the generation of the DDL from the schema.
  81. {{{
  82. propel.addValidators = {none}|maxvalue|type|required|unique|all
  83. }}}
  84. Which Propel validators to add to the generated schema (based on the db constraints).
  85. === Customizing Generated Object Model ===
  86. {{{
  87. propel.addGenericAccessors = true|{false}
  88. propel.addGenericMutators = true|{false}
  89. }}}
  90. Whether to add generic getter/setter methods -- e.g. '''getByName()''', '''setByName()'''.
  91. {{{
  92. propel.addTimeStamp = true|{false}
  93. }}}
  94. Whether to add a timestamp to the phpdoc header of generated OM classes.
  95. {{{
  96. propel.addValidateMethod = {true}|false
  97. }}}
  98. Whether to add `validate()` method to your classes. Set to false if you don't use Propel validation.
  99. {{{
  100. propel.addIncludes = {true}|false
  101. }}}
  102. Whether to add `require` statements on the generated stub classes. Set to false if you autoload every classe at runtime.
  103. {{{
  104. propel.addHooks = {true}|false
  105. }}}
  106. Whether to support pre- and post- hooks on `save()` and `delete()` methods. Set to false if you never use these hooks for a small speed boost.
  107. {{{
  108. propel.basePrefix = {Base}|/YourPrefix/
  109. }}}
  110. The prefix to use for the base (super) classes that are generated.
  111. {{{
  112. propel.classPrefix = {empty}|string;
  113. }}}
  114. Some sort of "namespacing": All Propel classes with get the Prefix "My_ORM_Prefix_" just like "My_ORM_Prefix_BookPeer".
  115. {{{
  116. propel.disableIdentifierQuoting = true|{false}
  117. }}}
  118. Identifier quoting is only implemented at the DDL layer at this point. Since this may result in undesired behavior (especially in Postgres), it can be disabled by setting this property to true.
  119. {{{
  120. propel.useLeftJoinsInDoJoinMethods = {true}|false
  121. }}}
  122. Set whether the '''doSelectJoin*()''' methods use LEFT JOIN or INNER JOIN (see ticket:491 and ticket:588 to understand more about why this might be important).
  123. === MySQL-specific Settings ===
  124. {{{
  125. propel.mysqlTableType = /DefaultTableEngine/
  126. }}}
  127. Default table engine - defaults to MyISAM. You can override this setting if you wish to default to another engine for all tables (for instance InnoDB, or HEAP). This setting can also be overridden on a per-table basis using the `<vendor>` element in the schema (see [wiki:Documentation/1.5/Schema#AddingVendorInfo]).
  128. {{{
  129. propel.mysqlTableEngineKeyword = /EngineKeyword/
  130. }}}
  131. Keyword used to specify the table engine in the CREATE SQL statement. Defaults to 'ENGINE', users of MYSQL < 5 should use 'TYPE' instead.
  132. === Date/Time Settings ===
  133. {{{
  134. propel.useDateTimeClass = true|{false}
  135. }}}
  136. This is how you enable full use of the new DateTime class in Propel. Setting this to true means that getter methods for date/time/timestamp columns will return a DateTime object ''when the default format is empty''. Note that the current default of ''false'' is only for backwards compatibility; in the future ''true'' will be the only option here.
  137. {{{
  138. propel.dateTimeClass = {DateTime}|string
  139. }}}
  140. Specify a custom DateTime subclass that you wish to have Propel use for temporal values.
  141. {{{
  142. propel.defaultTimeStampFormat = {Y-m-d H:i:s}|string
  143. propel.defaultTimeFormat = {%X}|string
  144. propel.defaultDateFormat = {%x}|string
  145. }}}
  146. These are the default formats that will be used when fetching values from temporal columns in Propel. You can always specify these when calling the methods directly, but for methods like getByName() it is nice to change the defaults.
  147. To have these methods return DateTime objects instead, you should set these to empty values, for example:
  148. {{{
  149. propel.defaultTimeStampFormat =
  150. }}}
  151. === Directories ===
  152. {{{
  153. propel.project.dir = default-depends-on-installation-type
  154. }}}
  155. ''This is not necessarily a property you can change.'' The project directory is the directory where you project files (build.properties, schema.xml, runtime-conf.xml, etc.) are located. For example, if you use the {{{propel-gen}}} script, this value will get overridden to the path you pass to {{{propel-gen}}}.
  156. {{{
  157. propel.output.dir = ${propel.project.dir}/build
  158. }}}
  159. The default top-level directory for output of classes, sql, config, etc.
  160. {{{
  161. propel.schema.dir = ${propel.project.dir}
  162. }}}
  163. The directory where Propel expects to find your schema.xml file.
  164. {{{
  165. propel.conf.dir = ${propel.project.dir}
  166. }}}
  167. The directory where Propel expects to find your {{{runtime-conf.xml}}} file.
  168. {{{
  169. propel.php.dir = ${propel.output.dir}/classes
  170. }}}
  171. The directory where Propel will create generated object model classes.
  172. {{{
  173. propel.phpconf.dir = ${propel.output.dir}/conf
  174. }}}
  175. The directory where Propel will place the php-ified version of your {{{runtime-conf.xml}}}.
  176. {{{
  177. propel.sql.dir = ${propel.output.dir}/sql
  178. }}}
  179. The directory where Propel will place generated DDL (or data insert statements, etc.)
  180. === Overriding Builder Classes ===
  181. {{{
  182. # Object Model builders
  183. propel.builder.peer.class = propel.engine.builder.om.php5.PHP5ComplexPeerBuilder
  184. propel.builder.object.class = propel.engine.builder.om.php5.PHP5ComplexObjectBuilder
  185. propel.builder.objectstub.class = propel.engine.builder.om.php5.PHP5ExtensionObjectBuilder
  186. propel.builder.peerstub.class = propel.engine.builder.om.php5.PHP5ExtensionPeerBuilder
  187. propel.builder.objectmultiextend.class = propel.engine.builder.om.php5.PHP5MultiExtendObjectBuilder
  188. propel.builder.tablemap.class = propel.engine.builder.om.php5.PHP5TableMapBuilder
  189. propel.builder.interface.class = propel.engine.builder.om.php5.PHP5InterfaceBuilder
  190. propel.builder.node.class = propel.engine.builder.om.php5.PHP5NodeBuilder
  191. propel.builder.nodepeer.class = propel.engine.builder.om.php5.PHP5NodePeerBuilder
  192. propel.builder.nodestub.class = propel.engine.builder.om.php5.PHP5ExtensionNodeBuilder
  193. propel.builder.nodepeerstub.class = propel.engine.builder.om.php5.PHP5ExtensionNodePeerBuilder
  194. propel.builder.nestedset.class = propel.engine.builder.om.php5.PHP5NestedSetBuilder
  195. propel.builder.nestedsetpeer.class = propel.engine.builder.om.php5.PHP5NestedSetPeerBuilder
  196. # SQL builders
  197. propel.builder.ddl.class = propel.engine.builder.sql.${propel.database}.${propel.database}DDLBuilder
  198. propel.builder.datasql.class = propel.engine.builder.sql.${propel.database}.${propel.database}DataSQLBuilder
  199. # Platform classes
  200. propel.platform.class = propel.engine.platform.${propel.database}Platform
  201. # Pluralizer class (used to generate plural forms)
  202. propel.builder.pluralizer.class = propel.engine.builder.util.DefaultEnglishPluralizer
  203. }}}
  204. As you can see, you can specify your own builder and platform classes if you want to extend & override behavior in the default classes
  205. === Adding Behaviors ===
  206. {{{
  207. propel.behavior.timestampable.class = propel.engine.behavior.TimestampableBehavior
  208. }}}
  209. Define the path to the class to be used for the `timestampable` behavior. This behavior is bundled wit hPropel, but if you want to override it, you can specify a different path.
  210. If you want to add more behaviors, write their path following the same model:
  211. {{{
  212. propel.behavior.my_behavior.class = my.custom.path.to.MyBehaviorClass
  213. }}}
  214. Behaviors are enabled on a per-table basis in the `schema.xml`. However, you can add behaviors for all your schemas, provided that you define them in the `propel.behavior.default` setting:
  215. {{{
  216. propel.behavior.default = soft_delete,my_behavior
  217. }}}