Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit f01e2a152335deac14384e02d98f2431f66b35dc @willdurand willdurand committed Aug 25, 2011
1 .gitignore
@@ -0,0 +1 @@
+_site/
3 _config.yml
@@ -0,0 +1,3 @@
+pygments: true
+markdown: rdiscount
+permalink: none
72 _layouts/default.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
+ <head>
+ <title>{{ page.title }}</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <meta name="language" content="en" />
+ <link rel="stylesheet" type="text/css" media="all" href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css" />
+ <link rel="stylesheet" type="text/css" media="all" href="css/layout.css" />
+ <link rel="stylesheet" type="text/css" media="all" href="css/markdown.css" />
+ <link rel="stylesheet" type="text/css" media="all" href="css/base_syntax.css" />
+ <link rel="stylesheet" type="text/css" media="all" href="css/syntax.css" />
+ <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
+ <base href="http://propelorm.github.com/propel-docs/" />
+ </head>
+ <body>
+ <div id="fond">
+ <div class="layout">
+ <ul class="topmenu">
+ <li class="element first">
+ <a class="link" href="documentation">Documentation</a>
+ </li>
+ <li class="element">
+ <a class="link" href="reference">The Reference Guide</a>
+ </li>
+ <li class="element">
+ <a class="link" href="cookbook">The Cookbook</a>
+ </li>
+ <li class="last element">
+ <a class="link" href="contribute">Contribute</a>
+ </li>
+ </ul>
+ <div id="banner">
+ <div id="text">
+ <h2 class="title">
+ Propel
+ </h2>
+ <p class="title">
+ Smart, easy object persistence.
+ </p>
+ </div>
+ </div>
+ <div class="ribbon">
+ <a href="https://github.com/propelorm/Propel" rel="me">Fork me on GitHub</a>
+ </div>
+ <div class="content markdown">
+ {{ content }}
+ </div>
+ </div>
+ <div class="bottom">
+ <p>
+ <ul>
+ <li class="element first">
+ <a class="link" href="documentation">Documentation</a>&nbsp;|&nbsp;
+ </li>
+ <li class="element">
+ <a class="link" href="reference">The Reference Guide</a>&nbsp;|&nbsp;
+ </li>
+ <li class="element">
+ <a class="link" href="cookbook">The Cookbook</a>&nbsp;|&nbsp;
+ </li>
+ <li class="last element">
+ <a class="link" href="contribute">Contribute</a>
+ </li>
+ </ul>
+ </p>
+ </div>
+
+ </div>
+ <script type="text/javascript">
+ </script>
+ </body>
+</html>
68 css/base_syntax.css
@@ -0,0 +1,68 @@
+.highlight .c { color: #008800; font-style: italic; } /* Comment */
+.highlight .err { color: #ffffff } /* Error */
+.highlight .g { color: #ffffff } /* Generic */
+.highlight .k { color: #fb660a; font-weight: bold } /* Keyword */
+.highlight .l { color: #ffffff } /* Literal */
+.highlight .n { color: #ffffff } /* Name */
+.highlight .o { color: #ffffff } /* Operator */
+.highlight .x { color: #ffffff } /* Other */
+.highlight .p { color: #ffffff } /* Punctuation */
+.highlight .cm { color: #008800; font-style: italic; } /* Comment.Multiline */
+.highlight .cp { color: #ff0007; font-weight: bold; font-style: italic; } /* Comment.Preproc */
+.highlight .c1 { color: #008800; font-style: italic; } /* Comment.Single */
+.highlight .cs { color: #008800; font-style: italic; } /* Comment.Special */
+.highlight .gd { color: #ffffff } /* Generic.Deleted */
+.highlight .ge { color: #ffffff } /* Generic.Emph */
+.highlight .gr { color: #ffffff } /* Generic.Error */
+.highlight .gh { color: #ffffff; font-weight: bold } /* Generic.Heading */
+.highlight .gi { color: #ffffff } /* Generic.Inserted */
+.highlight .go { color: #444444; background-color: #222222 } /* Generic.Output */
+.highlight .gp { color: #ffffff } /* Generic.Prompt */
+.highlight .gs { color: #ffffff } /* Generic.Strong */
+.highlight .gu { color: #ffffff; font-weight: bold } /* Generic.Subheading */
+.highlight .gt { color: #ffffff } /* Generic.Traceback */
+.highlight .kc { color: #fb660a; font-weight: bold } /* Keyword.Constant */
+.highlight .kd { color: #fb660a; font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { color: #fb660a; font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { color: #fb660a } /* Keyword.Pseudo */
+.highlight .kr { color: #fb660a; font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #cdcaa9; font-weight: bold } /* Keyword.Type */
+.highlight .ld { color: #ffffff } /* Literal.Date */
+.highlight .m { color: #0086f7; font-weight: bold } /* Literal.Number */
+.highlight .s { color: #0086d2 } /* Literal.String */
+.highlight .na { color: #ff0086; font-weight: bold } /* Name.Attribute */
+.highlight .nb { color: #ffffff } /* Name.Builtin */
+.highlight .nc { color: #ffffff } /* Name.Class */
+.highlight .no { color: #0086d2 } /* Name.Constant */
+.highlight .nd { color: #ffffff } /* Name.Decorator */
+.highlight .ni { color: #ffffff } /* Name.Entity */
+.highlight .ne { color: #ffffff } /* Name.Exception */
+.highlight .nf { color: #ff0086; font-weight: bold } /* Name.Function */
+.highlight .nl { color: #ffffff } /* Name.Label */
+.highlight .nn { color: #ffffff } /* Name.Namespace */
+.highlight .nx { color: #ffffff } /* Name.Other */
+.highlight .py { color: #ffffff } /* Name.Property */
+.highlight .nt { color: #fb660a; font-weight: bold } /* Name.Tag */
+.highlight .nv { color: #fb660a } /* Name.Variable */
+.highlight .ow { color: #ffffff } /* Operator.Word */
+.highlight .w { color: #888888 } /* Text.Whitespace */
+.highlight .mf { color: #0086f7; font-weight: bold } /* Literal.Number.Float */
+.highlight .mh { color: #0086f7; font-weight: bold } /* Literal.Number.Hex */
+.highlight .mi { color: #0086f7; font-weight: bold } /* Literal.Number.Integer */
+.highlight .mo { color: #0086f7; font-weight: bold } /* Literal.Number.Oct */
+.highlight .sb { color: #0086d2 } /* Literal.String.Backtick */
+.highlight .sc { color: #0086d2 } /* Literal.String.Char */
+.highlight .sd { color: #0086d2 } /* Literal.String.Doc */
+.highlight .s2 { color: #0086d2 } /* Literal.String.Double */
+.highlight .se { color: #0086d2 } /* Literal.String.Escape */
+.highlight .sh { color: #0086d2 } /* Literal.String.Heredoc */
+.highlight .si { color: #0086d2 } /* Literal.String.Interpol */
+.highlight .sx { color: #0086d2 } /* Literal.String.Other */
+.highlight .sr { color: #0086d2 } /* Literal.String.Regex */
+.highlight .s1 { color: #0086d2 } /* Literal.String.Single */
+.highlight .ss { color: #0086d2 } /* Literal.String.Symbol */
+.highlight .bp { color: #ffffff } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #fb660a } /* Name.Variable.Class */
+.highlight .vg { color: #fb660a } /* Name.Variable.Global */
+.highlight .vi { color: #fb660a } /* Name.Variable.Instance */
+.highlight .il { color: #0086f7; font-weight: bold } /* Literal.Number.Integer.Long */
243 css/layout.css
@@ -0,0 +1,243 @@
+a {
+ color:#000;
+ text-decoration:none;
+}
+
+a:hover, a:focus {
+ color:#00f010;
+}
+
+p, li {
+ font-size: 16px;
+ line-height:21px;
+ word-spacing: 0px;
+ text-align: justify;
+ margin-bottom: 10px;
+}
+
+li {
+ list-style-type: disc outside none;
+ margin-bottom: 5px;
+}
+
+body {
+ margin:0;
+ padding:0;
+ color:#000;
+ font-family: Georgia,"Times New Roman",serif;
+ background:#fff url(../images/background.png) top repeat-x;
+}
+
+.on_top {
+ float:right;
+ padding:0px;
+ color:#000;
+ margin:0px auto;
+ text-align:right;
+ font-weight: bold;
+ width:400px;
+}
+
+.on_top p {
+ margin:0;
+ padding:0;
+ margin-top:10px;
+}
+
+
+.layout {
+ padding:0;
+ width: 960px;
+ margin: 0 auto;
+}
+
+#sky {
+ top:0;
+ padding:0;
+ height:195px;
+ margin:0 auto;
+ text-align:right;
+}
+
+#text {
+ position:absolute;
+ margin-top:80px;
+ width:960px;
+ margin-left: 50px;
+}
+
+h1.hidden {
+ display:none;
+}
+
+h2.title {
+ color: #FFFFFF;
+ font-family: Tahoma;
+ font-size: 6em;
+ font-weight: bold;
+ letter-spacing: -3px;
+}
+
+p.title {
+ font-size: 3em;
+ font-style: italic;
+}
+
+h2.title a,
+h2.title a:hover {
+ text-decoration:none;
+}
+
+h2.title a:focus {
+ text-decoration:underline;
+}
+
+.content {
+ clear:both;
+ width: 100%;
+ margin: 30px 40px;
+ padding-top: 260px;
+}
+
+.navigation_bread_crumb {
+ margin:0px;
+ margin-bottom:10px;
+}
+
+.navigation_bread_crumb ol {
+ list-style-type: none;
+}
+
+.navigation_bread_crumb li {
+ display:inline;
+ font-size:11px;
+ margin-right:5px;
+}
+
+.navigation_bread_crumb li a {
+ color:#000;
+}
+
+.navigation_bread_crumb li a:hover,
+.navigation_bread_crumb li a:focus {
+ color:#00f010;
+}
+
+/* BOTTOM */
+.bottom {
+ background-color:#00f010;
+ font-size:12px;
+ text-align:center;
+ margin-top:10px;
+ padding:10px;
+}
+
+.bottom p {
+ margin:3px;
+ text-align: center;
+ line-height: 1em;
+ font-size:12px;
+}
+
+.bottom a {
+ color:#fff;
+}
+
+.bottom a:focus,
+.bottom a:hover {
+ color:#fff;
+}
+.bottom li{
+ display:inline-block;
+}
+
+h1 {
+ color:#000;
+ font-size:2.7em;
+ font-weight: bold;
+ margin-top:20px;
+ margin-bottom:20px;
+ letter-spacing:-2px;
+}
+
+h1.no_margin_bottom {
+ margin-bottom:20px;
+}
+
+#scrollToTop a {
+ position: fixed;
+ right: 20px;
+ bottom: 10px;
+ background-color: rgb(255,255,255); /** rgba fallback**/
+ background-color: rgba(255,255,255, 0.7);
+ padding: 7px 10px;
+}
+
+#scrollToTop a:hover {
+ text-decoration: none !important;
+}
+
+.topmenu {
+ float:left;
+ margin-top:10px;
+}
+
+.topmenu ul li {
+ list-style-type:none;
+}
+
+.topmenu li.element {
+ display:inline;
+ margin-left:10px;
+ margin-right:10px;
+ padding:0 5px 0 5px;
+}
+
+.ribbon {
+ background-color: #a00;
+ overflow: hidden;
+ /* top left corner */
+ position: absolute;
+ left: -3em;
+ top: 2.5em;
+ /* 45 deg ccw rotation */
+ -moz-transform: rotate(-45deg);
+ -webkit-transform: rotate(-45deg);
+ /* shadow */
+ -moz-box-shadow: 0 0 1em #888;
+ -webkit-box-shadow: 0 0 1em #888;
+}
+
+.ribbon a {
+ border: 1px solid #faa;
+ color: #fff;
+ display: block;
+ font: bold 81.25% 'Helvetiva Neue', Helvetica, Arial, sans-serif;
+ margin: 0.05em 0 0.075em 0;
+ padding: 0.5em 3.5em;
+ text-align: center;
+ text-decoration: none;
+ /* shadow */
+ text-shadow: 0 0 0.5em #444;
+}
+
+.navigation {
+ padding-top:10px;
+ padding-bottom:10px;
+ text-align:center;
+}
+
+.left, .right {
+ display:inline;
+ margin: 10px;
+}
+
+.current {
+ color: black;
+ font-weight: bold;
+}
+
+.italic {
+ font-style: italic;
+}
+
118 css/markdown.css
@@ -0,0 +1,118 @@
+.markdown h2 {
+ padding-top:10px;
+ font-size: 1.8em;
+ font-weight:bold;
+ margin:1.5em 0 0.8em 0;
+ border-top:7px solid #00f010;
+}
+
+.markdown h2 .link {
+ color:#000;
+ text-decoration: none;
+}
+
+.markdown h3 {
+ color:#000;
+ font-size: 1.6em;
+ margin: 1em 0 0.5em 0;
+}
+
+.markdown h4 {
+ color: #000;
+ font-size:1.2em;
+ font-style:italic;
+ margin:1.5em 0 1em 0;
+}
+
+.markdown h5 {
+ font-weight: bold;
+}
+
+.markdown em {
+ font-style: italic;
+}
+
+.markdown strong {
+ font-weight: bold;
+}
+
+.markdown ul {
+ margin-bottom: 1em;
+}
+
+.markdown ul li {
+ list-style: disc inside;
+ margin-bottom: 10px;
+}
+
+.markdown ul li li {
+ list-style: circle inside;
+ margin-left: 1em;
+}
+
+.markdown ol li {
+ list-style: decimal inside;
+ margin-bottom: 1em;
+}
+
+.markdown li p {
+ display: inline;
+}
+
+.markdown pre {
+ font-family:"Bitstream Vera Sans Mono",monospace;
+ background: #222;
+ padding: 5px;
+ color: #fff;
+ margin-bottom: 1em;
+ max-width:100%;
+ overflow-y:auto;
+}
+
+.markdown blockquote {
+ background: #F8F8FF;
+ padding: 10px;
+ padding-bottom:0px;
+ margin: 1em 40px;
+ border: 1px solid #ddddee;
+ color: #222;
+}
+
+.markdown blockquote strong {
+ margin: -10px -10px;
+ display: block;
+ padding: 10px 0 10px 50px;
+ background: #ddddee url(../images/info.png) top left no-repeat;
+ background-position: 5px 2px;
+ letter-spacing: 1px;
+}
+
+.markdown table {
+ width:100%;
+ font-size: 1em;
+ margin-bottom: 20px;
+}
+
+.markdown tbody tr td {
+ padding:4px 10px 4px 5px;
+ border-bottom: 1px solid #ccc;
+}
+
+.markdown thead tr th {
+ background: #eee;
+ padding: 1em;
+}
+
+.markdown img {
+ border:1px solid #AAAAAA;
+ margin:0.5em auto;
+ max-width:100%;
+ text-align:center;
+ display: block;
+}
+
+.markdown img.inline {
+ vertical-align: middle;
+ margin: 0 0.5m;
+ border: none;
+}
19 css/syntax.css
@@ -0,0 +1,19 @@
+code.php .k {color: #FF8400}
+code.php .s1 {color: #56D036}
+code.php .c1 {color: #BD48B3; font-style: italic}
+code.php .coMULTI {color: #BD48B3; font-style: italic}
+code.php .p {color: #999}
+code.php .nv {color: #fff}
+code.php a {text-decoration: none}
+code.php .cp {display:none;}
+code.php .na {color: #fff;}
+code.php .nf {color: #fff;}
+
+code.xml .cp {color: #A829D9; font-style: italic}
+code.xml .s {color: #56DB39;}
+code.xml .nt {color: #ccc;}
+
+code.yaml .p-Indicator {color: #FF8400;}
+code.yaml .c1 {color: #ccc; font-style: italic;}
+code.yaml .s {color: #0086d2;}
+code.yaml .nv {color: #fff;}
BIN images/background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/info.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/propel-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 index.markdown
@@ -0,0 +1,6 @@
+---
+layout: default
+title: Propel documentation
+---
+
+Hello :)
469 reference/schema.markdown
@@ -0,0 +1,469 @@
+---
+layout: default
+title: "Database Schema"
+---
+
+# Database Schema #
+
+The schema for `schema.xml` contains a small number of elements with required and optional attributes. The Propel generator contains a DTD that can be used to validate your `schema.xml` document. Also, when you build your SQL and OM, the Propel generator will automatically validate your `schema.xml` file using a highly-detailed XSD.
+
+## At-a-Glance ##
+
+The hierarchical tree relationship for the elements is:
+
+{% highlight xml %}
+<database>
+ <table>
+ <column>
+ <inheritance />
+ </column>
+ <foreign-key>
+ <reference />
+ </foreign-key>
+ <index>
+ <index-column />
+ </index>
+ <unique>
+ <unique-column />
+ </unique>
+ <id-method-parameter/>
+ </table>
+ <external-schema />
+</database>
+{% endhighlight %}
+
+You can find example schemas in the test fixtures that the Propel development team uses for unit testing. For instance, the bookstore schema describes the model of a Bookstore application.
+
+>**Tip** <br />If you use an IDE supporting autocompletion in XML documents, you can take advantage of the XSD describing the `schema.xml` syntax to suggest elements and attributes as you type. To enable it, add a `xmlns:xsi` and a `xsi:noNamespaceSchemaLocation` attribute to the leading `<database>` tag:
+
+{% highlight xml %}
+<database name="my_connection_name" defaultIdMethod="native"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://svn.propelorm.org/branches/1.6/generator/resources/xsd/database.xsd" >
+{% endhighlight %}
+
+## Detailed Reference ##
+
+This page provides an alternate rendering of the Appendix B - Schema Reference from the user's guide.
+It spells out in specific detail, just where each attribute or element belongs.
+
+First, some conventions:
+
+* 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.)
+* Optional items are surrounded by `[` and `]` characters.
+* Items where you have an alternative choice have a `|` character between them (i.e. true|false)
+* Alternative choices may be delimited by `{` and `}` to indicate that this is the default option, if not overridden elsewhere.
+* **...** means repeat the previous item.
+
+### "Database" element ###
+
+Starting with the `<database>` element. The _attributes_ and _elements_ available are:
+
+{% highlight xml %}
+<database
+ name="/DatabaseName/"
+ defaultIdMethod="native|none"
+ [package="/ProjectName/"]
+ [schema="/SQLSchema/"]
+ [namespace="/ClassNamespace/"]
+ [baseClass="/baseClassName/"]
+ [basePeer="/baseClassPeerName/"]
+ [defaultPhpNamingMethod="nochange|{underscore}|phpname|clean"
+ [heavyIndexing="true|false"]
+ [tablePrefix="/tablePrefix/"]
+>
+ <table>
+ <external-schema>
+ ...
+</database>
+{% endhighlight %}
+
+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.
+* `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.
+* `defaultPhpNamingMethod` the default naming method to use for tables of this database. Defaults to `underscore`, which transforms table names into CamelCase phpNames.
+* `heavyIndexing` adds indexes for each component of the primary key (when using composite primary keys).
+* `tablePrefix` adds a prefix to all the SQL table names.
+
+### "Table" element ###
+
+The `<table>` element is the most complicated of the usable elements. Its definition looks like this:
+
+{% highlight xml %}
+<table
+ name = "/TableName/"
+ [idMethod = "native|{none}"]
+ [phpName = "/PhpObjectName/"]
+ [package="/PhpObjectPackage/"]
+ [schema="/SQLSchema/"]
+ [namespace = "/PhpObjectNamespace/"]
+ [skipSql = "true|false"]
+ [abstract = "true|false"]
+ [phpNamingMethod = "nochange|{underscore}|phpname|clean"]
+ [baseClass = "/baseClassName/"]
+ [basePeer = "/baseClassPeerName/"]
+ [description="/A text description of the table/"]
+ [heavyIndexing = "true|false"]
+ [readOnly = "true|false"]
+ [treeMode = "NestedSet|MaterializedPath"]
+ [reloadOnInsert = "true|false"]
+ [reloadOnUpdate = "true|false"]
+ [allowPkInsert = "true|false"]
+>
+
+ <column>
+ ...
+ <foreign-key>
+ ...
+ <index>
+ ...
+ <unique>
+ ...
+ <id-method-parameter>
+ ...
+</table>
+{% endhighlight %}
+
+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 supporting VIEWS in Propel.
+* `abstract` Whether the generated _stub_ class will be abstract (e.g. if you're using inheritance)
+* `phpNamingMethod` the naming method to use. Defaults to `underscore`, which transforms the table name into a CamelCase phpName.
+* `baseClass` allows you to specify a class that the 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`).
+* `heavyIndexing` adds indexes for each component of the primary key (when using composite primary keys).
+* `readOnly` suppresses the mutator/setter methods, save() and delete() methods.
+* `treeMode` is used to indicate that this table is part of a node tree. Currently the only supported values are "!NestedSet" (see [wiki:Documentation/1.6/Behaviors/nested_set]) and "!MaterializedPath" (deprecated).
+* `reloadOnInsert` is used to indicate that the object should be reloaded from the database when an INSERT is performed. This is useful if you have triggers (or other server-side functionality like column default expressions) that alters the database row on INSERT.
+* `reloadOnUpdate` is used to indicate that the object should be reloaded from the database when an UPDATE is performed. This is useful if you have triggers (or other server-side functionality like column default expressions) that alters the database row on UPDATE.
+* `allowPkInsert` can be used if you want to define the primary key of a new object being inserted. By default if idMethod is "native", Propel would throw an exception. However, in some cases this feature is useful, for example if you do some replication of data in an master-master environment. It defaults to false.
+
+### "column" element ###
+
+{% highlight xml %}
+<column
+ name = "/ColumnName/"
+ [phpName = "/PHPColumnName/"]
+ [peerName = "/PEERNAME/"]
+ [primaryKey = "true|{false}"]
+ [required = "true|{false}"]
+ [type = "BOOLEAN|TINYINT|SMALLINT|INTEGER|BIGINT|DOUBLE|FLOAT|REAL|DECIMAL|CHAR|{VARCHAR}|LONGVARCHAR|DATE|TIME|TIMESTAMP|BLOB|CLOB|OBJECT|ARRAY"]
+ [phpType = "boolean|int|integer|double|float|string|/BuiltInClassName/|/UserDefinedClassName/"]
+ [sqlType = "/NativeDatabaseColumnType/"
+ [size = "/NumericLengthOfColumn/"]
+ [scale = "/DigitsAfterDecimalPlace/"]
+ [defaultValue = "/AnyDefaultValueMatchingType/"]
+ [defaultExpr = "/AnyDefaultExpressionMatchingType/"]
+ [valueSet = "/CommaSeparatedValues/"]
+ [autoIncrement = "true|{false}"]
+ [lazyLoad = "true|{false}"]
+ [description = "/Column Description/"]
+ [primaryString = "true|{false}"]
+ [phpNamingMethod = "nochange|underscore|phpname"]
+ [inheritance = "single|{false}"]
+ >
+ [<inheritance key="/KeyName/" class="/ClassName/" [extends="/BaseClassName/"] />]
+</column>
+{% endhighlight %}
+
+#### Column Attributes ####
+
+* `type` The database-agnostic column type. Propel maps native SQL types to these types depending on the RDBMS. Using Propel types guarantees that a column definition is portable.
+* `sqlType` The SQL type to be used in CREATE and ALTER statements (overriding the mapping between Propel types and RMDBS type)
+* `defaultValue` The default value that the object will have for this column in the PHP instance after creating a "new Object". This value is always interpreted as a string.
+* `defaultExpr` The default value for this column as expressed in SQL. This value is used solely for the "sql" target which builds your database from the schema.xml file. The defaultExpr is the SQL expression used as the "default" for the column.
+* `valueSet` The list of enumerated values accepted on an ENUM column. The list contains 255 values at most, separated by commas.
+* `lazyLoad` A lazy-loaded column is not fetched from the database by model queries. Only the generated getter method for such a column issues a query to the database. Useful for large column types (such as CLOB and BLOB).
+* `primaryString` A column defined as primary string serves as default value for a `__toString()` method in the generated Propel object.
+
+**Tip**: For performance reasons, it is often a good idea to set BLOB and CLOB columns as lazyLoaded. A resultset containing one of more very large columns takes time to transit between the database and the PHP server, so you want to make sure this only happen when you actually need it.
+
+### "foreign-key" element ###
+
+To link a column to another table use the following syntax:
+
+{% highlight 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/"]
+ [onDelete = "cascade|setnull|restrict|none"]
+ [onUpdate = "cascade|setnull|restrict|none"]
+ [skipSql = "true|false"]
+ [defaultJoin= "Criteria::INNER_JOIN|Criteria::LEFT_JOIN"]
+>
+ <reference local="/LocalColumnName/" foreign="/ForeignColumnName/" />
+</foreign-key>
+{% endhighlight %}
+
+#### Foreign Key Attributes ####
+
+* `skipSql` Instructs Propel not to generate DDL SQL for the specified foreign key. This can be used to support relationships in the model without an actual foreign key.
+* `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 ###
+
+To create an index on one or more columns, use the following syntax:
+
+{% highlight xml %}
+<index [name="/IndexName/"]>
+ <index-column name="/ColumnName/" [size="/LengthOfIndexColumn/"] />
+ ...
+</index>
+{% endhighlight %}
+
+In some cases your RDBMS may require you to specify an index size.
+
+### "unique" element ###
+
+To create a unique index on one or more columns, use the following syntax:
+
+{% highlight xml %}
+<unique [name="/IndexName/"]>
+ <unique-column name="/ColumnName/" [size="/LengthOfIndexColumn/"] />
+ ...
+</unique>
+{% endhighlight %}
+
+In some cases your RDBMS may require you to specify an index size for unique indexes.
+
+### "id-method-parameter" element ###
+
+If you are using a database that uses sequences for auto-increment columns (e.g. PostgreSQL or Oracle), you can customize the name of the sequence using the `<id-method-parameter>` tag:
+
+{% highlight xml %}
+<id-method-parameter value="my_custom_sequence_name"/>
+{% endhighlight %}
+
+### "external-schema" element ###
+
+The `<external-schema>` element includes another schema file from the filesystem into the current schema. The format is:
+
+{% highlight xml %}
+<external-schema
+ filename="/a path to a file/"
+ referenceOnly="{true}|false"
+/>
+{% endhighlight %}
+
+The `filename` can be relative or absolute. Beware that the external schema must contain a `<database>` with the same name as the current element. By default, tables from external schemas are ignored by the `sql` task - that means that Propel won't try to _insert_ the external tables. If you want Propel to take the tables from an external schema into account in SQL, set the `referenceOnly` attribute to `false`.
+
+## Column Types ##
+
+Here are the Propel column types with some example mappings to native database and PHP types. There are also several ways to customize the mapping between these types.
+
+### Text Types ###
+
+|Propel Type|Desc |Example Default DB Type (MySQL)|Default PHP Native Type|
+|-----------|-----------------------------------|-------------------------------|-----------------------|
+|CHAR |Fixed-length character data |CHAR |string |
+|VARCHAR |Variable-length character data |VARCHAR |string |
+|LONGVARCHAR|Long variable-length character data|TEXT |string |
+|CLOB |Character LOB (locator object) |LONGTEXT |string |
+
+`LONGVARCHAR` and `CLOB` need no declared size, and allow for very large strings (up to 2^16 and 2^32 characters in MySQL for instance).
+
+### Numeric Types ###
+
+|Propel Type|Desc |Example Default DB Type (MySQL)|Default PHP Native Type |
+|-----------|-----------------------|-------------------------------|---------------------------|
+|NUMERIC |Numeric data |DECIMAL |string (PHP int is limited)|
+|DECIMAL |Decimal data |DECIMAL |string (PHP int is limited)|
+|TINYINT |Tiny integer |TINYINT |int |
+|SMALLINT |Small integer |SMALLINT |int |
+|INTEGER |Integer |INTEGER |int |
+|BIGINT |Large integer |BIGINT |string (PHP int is limited)|
+|REAL |Real number |REAL |double |
+|FLOAT |Floating point number |FLOAT |double |
+|DOUBLE |Floating point number |DOUBLE |double |
+
+**Tip**: `BIGINT` maps to a PHP string, and therefore allows for 64 bit integers even on 32 bit systems.
+
+### Binary Types ###
+
+|Propel Type |Desc |Example Default DB Type (MySQL)|Default PHP Native Type|
+|---------------|-----------------------------------|-------------------------------|-----------------------|
+|BINARY |Fixed-length binary data |BLOB |double |
+|VARBINARY |Variable-length binary data |MEDIUMBLOB |double |
+|LONGVARBINARY |Long variable-length binary data |LONGBLOB |double |
+|BLOB |Binary LOB (locator object) |LONGBLOB |stream or string |
+
+**Tip**: `BLOB` columns map to PHP as streams, and allows the storage of large binary objects (like images).
+
+### Temporal (Date/Time) Types ###
+
+|Propel Type|Desc |Example Default DB Type (MySQL)|Default PHP Native Type|
+|-----------|---------------------------------------|-------------------------------|-----------------------|
+|DATE |Date (e.g. YYYY-MM-DD) |DATE |DateTime object |
+|TIME |Time (e.g. HH:MM:SS) |TIME |DateTime object |
+|TIMESTAMP |Date + time (e.g. YYYY-MM-DD HH:MM:SS) |TIMESTAMP |DateTime object |
+
+### Other Types ###
+
+* `BOOLEAN` columns map to a boolean in PHP. Depending on the native support for this type, they are stored in SQL as `BOOLEAN` or `TINYINT`.
+* `ENUM` columns accept values among a list of predefined ones. Set the value set using the `valueSet` attribute, separated by commas.
+* `OBJECT` columns map to PHP objects and are stored as strings.
+* `ARRAY` columns map to PHP arrays and are stored as strings.
+
+### Legacy Temporal Types ###
+
+The following Propel 1.2 types are still supported, but are no longer needed with Propel 1.3.
+
+|Propel Type |Desc |Example Default DB Type (MySQL)|Default PHP Native Type|
+|---------------|-------------------------------------------------------|-------------------------------|-----------------------|
+|BU_DATE |Pre-/post-epoch date (e.g. 1201-03-02) |DATE |DateTime object |
+|BU_TIMESTAMP |Pre-/post-epoch Date + time (e.g. 1201-03-02 12:33:00) |TIMESTAMP |DateTime object |
+
+## Customizing Mappings ##
+
+### Specify Column Attributes ###
+
+You can change the way that Propel maps its own types to native SQL types or to PHP types by overriding the values for a specific column.
+
+For example:
+
+(Overriding PHP type)
+
+{% highlight xml %}
+<column name="population_served" type="INTEGER" phpType="string"/>
+{% endhighlight %}
+
+(Overriding SQL type)
+
+{% highlight xml %}
+<column name="ip_address" type="VARCHAR" sqlType="inet"/>
+{% endhighlight %}
+
+### Adding Vendor Info ###
+
+Propel supports database-specific elements in the schema (currently only for MySQL). This "vendor" parameters affect the generated SQL. To add vendor data, add a `<vendor>` tag with a `type` attribute specifying the target database vendor. In the `<vendor>` tag, add `<parameter>` tags with a `name` and a `value` attribue. For instance:
+
+{% highlight xml %}
+<table name="book">
+ <vendor type="mysql">
+ <parameter name="Engine" value="InnoDB"/>
+ <parameter name="Charset" value="utf8"/>
+ </vendor>
+</table>
+{% endhighlight %}
+
+This will change the generated SQL table creation to look like:
+
+{% highlight sql %}
+CREATE TABLE book
+ ()
+ ENGINE = InnoDB
+ DEFAULT CHARACTER SET utf8;
+{% endhighlight %}
+
+#### MySQL Vendor Info ####
+
+Propel supports the following vendor parameters for MySQL:
+
+{% highlight txt %}
+Name | Example values
+-----------------|---------------
+// in <table> element
+Engine | MYISAM (default), InnoDB, BDB, MEMORY, ISAM, MERGE, MRG_MYISAM, etc.
+AutoIncrement | 1234, N, etc
+AvgRowLength |
+Charset | utf8, latin1, etc.
+Checksum | 0, 1
+Collate | utf8_unicode_ci, latin1_german1_ci, etc.
+Connection | mysql://fed_user@remote_host:9306/federated/test_table (for FEDERATED storage engine)
+DataDirectory | /var/db/foo (for MyISAM storage engine)
+DelayKeyWrite | 0, 1
+IndexDirectory | /var/db/foo (for MyISAM storage engine)
+InsertMethod | FIRST, LAST (for MERGE storage Engine)
+KeyBlockSize | 0 (default), 1024, etc
+MaxRows | 1000, 4294967295, etc
+MinRows | 1000 (for MEMORY storage engine)
+PackKeys | 0, 1, DEFAULT
+RowFormat | FIXED, DYNAMIC, COMPRESSED, COMPACT, REDUNDANT
+Union | (t1,t2) (for MERGE storage Engine)
+// in <column> element
+Charset | utf8, latin1, etc.
+Collate | utf8_unicode_ci, latin1_german1_ci, etc.
+// in <index> element
+Index_type | FULLTEXT
+{% endhighlight %}
+
+#### Oracle Vendor Info ####
+
+Propel supports the following vendor parameters for Oracle:
+
+{% highlight txt %}
+Name | Example values
+-----------------|---------------
+// in <table> element
+PCTFree | 20
+InitTrans | 4
+MinExtents | 1
+MaxExtents | 99
+PCTIncrease | 0
+Tablespace | L_128K
+PKPCTFree | 20
+PKInitTrans | 4
+PKMinExtents | 1
+PKMaxExtents | 99
+PKPCTIncrease | 0
+PKTablespace | IL_128K
+// in <index> element
+PCTFree | 20
+InitTrans | 4
+MinExtents | 1
+MaxExtents | 99
+PCTIncrease | 0
+Tablespace | L_128K
+{% endhighlight %}
+
+### Using Custom Platform ###
+
+For overriding the mapping between Propel types and native SQL types, you can create your own Platform class and override the mapping.
+
+For example:
+
+{% highlight php %}
+require_once 'propel/engine/platform/MysqlPlatform.php';
+
+class CustomMysqlPlatform extends MysqlPlatform
+{
+ /**
+ * Initializes custom domain mapping.
+ */
+ protected function initialize()
+ {
+ parent::initialize();
+ $this->setSchemaDomainMapping(new Domain(PropelTypes::NUMERIC, "DECIMAL"));
+ $this->setSchemaDomainMapping(new Domain(PropelTypes::LONGVARCHAR, "TEXT"));
+ $this->setSchemaDomainMapping(new Domain(PropelTypes::BINARY, "BLOB"));
+ $this->setSchemaDomainMapping(new Domain(PropelTypes::VARBINARY, "MEDIUMBLOB"));
+ $this->setSchemaDomainMapping(new Domain(PropelTypes::LONGVARBINARY, "LONGBLOB"));
+ $this->setSchemaDomainMapping(new Domain(PropelTypes::BLOB, "LONGBLOB"));
+ $this->setSchemaDomainMapping(new Domain(PropelTypes::CLOB, "LONGTEXT"));
+ }
+}
+{% endhighlight %}
+
+You must then specify that mapping in the `build.properties` for your project:
+
+ propel.platform.class = propel.engine.platform.${propel.database}Platform
+

0 comments on commit f01e2a1

Please sign in to comment.