Permalink
Browse files

[1.6] Documented new schema attributes for SQL schema support (refs #940

)
  • Loading branch information...
1 parent 6c92271 commit 35daa2ed1f172264075ff9ce8a6081a365c4dfbb @fzaninotto fzaninotto committed Dec 14, 2010
Showing with 16 additions and 7 deletions.
  1. +2 −2 docs/reference/Buildtime-Configuration.txt
  2. +10 −4 docs/reference/Schema.txt
  3. +4 −1 generator/resources/dtd/database.dtd
@@ -59,13 +59,13 @@ propel.packageObjectModel = true|{false}
# will also stipulate the subdirectory in which model classes get generated.
propel.namespace.autoPackage = true|{false}
-# Whether to validate the schema using the XSD file.
+# Whether to validate the XML 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.
propel.schema.validate = {true}|false
-# Whether to transform the schema using the XSL file.
+# Whether to transform the XML 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`
View
@@ -64,6 +64,7 @@ Starting with the {{{<database>}}} element. The ''attributes'' and ''elements''
name="/DatabaseName/"
defaultIdMethod="native|none"
[package="/ProjectName/"]
+ [schema="/SQLSchema/"]
[namespace="/ClassNamespace/"]
[baseClass="/baseClassName/"]
[basePeer="/baseClassPeerName/"]
@@ -77,13 +78,15 @@ Starting with the {{{<database>}}} element. The ''attributes'' and ''elements''
</database>
}}}
-The `package`, `baseClass`, `basePeer`, `defaultPhpNamingMethod`, and `heavyIndexing` attributes are generally optional.
+Only the `name` and the `defaultIdMethod` attributes are required.
+
A Database element may include an `<external-schema>` element, or multiple `<table>` elements.
==== Database Attributes ====
* `defaultIdMethod` sets the default id method to use for auto-increment columns.
- * `package` specifies the "package" for the generated classes. Classes are created in subdirectories according to the `package` value.
+ * `package` specifies the "package" for the generated classes. Classes are created in subdirectories according to the `package` value.
+ * `schema` specifies the default SQL schema containing the tables. Ignored on RDBMS not supporting database schemas.
* `namespace` specifies the default namespace that generated model classes will use (PHP 5.3 only). This attribute can be completed or overridden at the table level.
* `baseClass` allows you to specify a default base class that all generated Propel objects should extend (in place of `propel.om.BaseObject`).
* `basePeer` instructs Propel to use a different SQL-generating `BasePeer` class (or sub-class of `BasePeer`) for all generated objects.
@@ -102,6 +105,7 @@ The `<table>` element is the most complicated of the usable elements. Its defini
[idMethod = "native|{none}"]
[phpName = "/PhpObjectName/"]
[package="/PhpObjectPackage/"]
+ [schema="/SQLSchema/"]
[namespace = "/PhpObjectNamespace/"]
[skipSql = "true|false"]
[abstract = "true|false"]
@@ -130,13 +134,14 @@ The `<table>` element is the most complicated of the usable elements. Its defini
</table>
}}}
-According to the schema, `name` is the only required attribute. Also, the `idMethod`, `package`, `namespace`, `phpNamingMethod`, `baseClass`, `basePeer`, and `heavyIndexing` attributes all default to what is specified by the `<database>` element.
+According to the schema, `name` is the only required attribute. Also, the `idMethod`, `package`, `schema`, `namespace`, `phpNamingMethod`, `baseClass`, `basePeer`, and `heavyIndexing` attributes all default to what is specified by the `<database>` element.
==== Table Attributes ====
* `idMethod` sets the id method to use for auto-increment columns.
* `phpName` specifies object model class name. By default, Propel uses a CamelCase version of the table name as phpName.
* `package` specifies the "package" (or subdirectory) in which model classes get generated.
+ * `schema` specifies the default SQL schema containing the table. Ignored on RDBMS not supporting database schemas.
* `namespace` specifies the namespace that the generated model classes will use (PHP 5.3 only). If the table namespace starts with a `\`, it overrides the namespace defined in the `<database>` tag; otherwise, the actual table namespace is the concatenation of the database namespace and the table namespace.
* `skipSql` instructs Propel not to generate DDL SQL for the specified table. This can be used together with `readOnly` for supperting VIEWS in Propel.
* `abstract` Whether the generated ''stub'' class will be abstract (e.g. if you're using inheritance)
@@ -200,6 +205,7 @@ To link a column to another table use the following syntax:
#!xml
<foreign-key
foreignTable = "/TheOtherTableName/"
+ [foreignSchema = "/TheOtherTableSQLSchema/"]
[name = "/Name for this foreign key/"]
[phpName = "/Name for the foreign object in methods generated in this class/"]
[refPhpName = "/Name for this object in methods generated in the foreign class/"]
@@ -213,7 +219,7 @@ To link a column to another table use the following syntax:
==== Foreign Key Attributes ====
- * {{{defaultJoin}}} This affects the default join type used in the generated `joinXXX()` methods in the model query class. Propel uses an INNER JOIN for foreign keys attached to a required column, and a LEFT JOIN for foreign keys attached to a non-required column, but you can override this in the foreign key element.
+ * `defaultJoin` This affects the default join type used in the generated `joinXXX()` methods in the model query class. Propel uses an INNER JOIN for foreign keys attached to a required column, and a LEFT JOIN for foreign keys attached to a non-required column, but you can override this in the foreign key element.
=== <index> element ===
@@ -27,6 +27,7 @@ PHP class or method name.
defaultIdMethod (native|none) "none"
defaultTranslateMethode CDATA #IMPLIED
package CDATA #IMPLIED
+ schema CDATA #IMPLIED
namespace CDATA #IMPLIED
baseClass CDATA #IMPLIED
basePeer CDATA #IMPLIED
@@ -49,14 +50,15 @@ PHP class or method name.
<!ATTLIST table
name CDATA #REQUIRED
phpName CDATA #IMPLIED
- namespace CDATA #IMPLIED
idMethod (native|autoincrement|sequence|none|null) "null"
skipSql (true|false) "false"
readOnly (true|false) "false"
abstract (true|false) "false"
isCrossRef (true|false) "false"
treeMode (MaterializedPath|NestedSet|AdjacencyList) "AdjacencyList"
package CDATA #IMPLIED
+ schema CDATA #IMPLIED
+ namespace CDATA #IMPLIED
baseClass CDATA #IMPLIED
basePeer CDATA #IMPLIED
alias CDATA #IMPLIED
@@ -117,6 +119,7 @@ PHP class or method name.
<!ELEMENT foreign-key (reference+, vendor*)>
<!ATTLIST foreign-key
foreignTable CDATA #REQUIRED
+ foreignSchema CDATA #IMPLIED
name CDATA #IMPLIED
phpName CDATA #IMPLIED
refPhpName CDATA #IMPLIED

0 comments on commit 35daa2e

Please sign in to comment.