Skip to content

Commit

Permalink
Configuration system refactor: documentation
Browse files Browse the repository at this point in the history
Update the documentation while refactoring Propel2 configuration system.
See propelorm/Propel2#527
  • Loading branch information
cristianoc72 committed Jul 26, 2014
1 parent a91860e commit 2323790
Show file tree
Hide file tree
Showing 22 changed files with 2,767 additions and 1,142 deletions.
32 changes: 32 additions & 0 deletions _layouts/configuration.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>Propel - The Blazing Fast Open-Source PHP 5.4 ORM</title>
{% include head.html %}
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
</head>
<body class="home">
{% include header.html %}
<section class="content">
<ul class="toc"></ul>
<div class="markdown">
{{ content }}
</div>
<p class="fork_and_edit">
Found a typo ? Something is wrong in this documentation ? Just <a
href="http://github.com/propelorm/propelorm.github.com/edit/master{{ page.url|replace:'.html','' }}.markdown">fork
and edit</a> it !
</p>
</section>
{% include footer.html %}
<script type="text/javascript" src="/js/jquery.tableofcontents.min.js" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.toc').tableOfContents(null, { startLevel: 2 });
$('.conftabs').each(function(){$(this).tabs();});
});
</script>
</body>
</html>
6 changes: 0 additions & 6 deletions behaviors/auto-add-pk.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ This behavior is more powerful if you add it to the database instead of a table.
</database>
```

You can even enable it for all your databases by adding it to the default behaviors in your `build.properties` file:

```ini
propel.behavior.default = auto_add_pk
```

## Parameters ##

By default, the behavior adds a column named `id` to the table if the table has no primary key. You can customize all the attributes of the added column by setting corresponding parameters in the behavior definition:
Expand Down
173 changes: 0 additions & 173 deletions cookbook/customizing-build.markdown

This file was deleted.

25 changes: 9 additions & 16 deletions cookbook/multi-component-data-model.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Propel comes along with packaging capabilities that allow you to more easily int

You can use as many `schema.xml` files as you want. Schema files have to be named `(*.)schema.xml`, so names like `schema.xml`, `package1.schema.xml`, `core.package1.schema.xml` are all acceptable. These files _have_ to be located in your project directory.

Each schema file has to contain a `<database>` element with a `name` attribute. This name references the connection settings to be used for this database (and configured in the `runtime-conf.xml`), so separated schemas can share a common database name.
Each schema file has to contain a `<database>` element with a `name` attribute. This name references the connection settings to be used for this database (and configured in the *database* section of your configuration file), so separated schemas can share a common database name.

Whenever you call a propel build tasks, Propel will consider all these schema files and build the classes (or the SQL) for all the tables.

Expand All @@ -23,10 +23,11 @@ In Propel, a _package_ represents a group of models. This is a convenient way to

The package is defined in a configuration cascade. You can set it up for the whole project, for all the tables of a schema, or for a single table.

For the whole project, the main package is set in the `build.properties`:
For the whole project, the main package is set in the *configuration file*:

```ini
propel.targetPackage = my_project
;example in ini format
propel.generator.targetPackage = my_project
```

By default, all the tables of all the schemas in the project use this package. However, you can override the package for a given `<database>` by setting its `package` attribute:
Expand Down Expand Up @@ -92,7 +93,7 @@ _Tip_: You can use dots in a package name to add more package levels.

The `package` attribute of a table translates to the directory in which Propel generates the Model classes for this table.

For instance, if no `package` attribute is defined at the database of table level, Propel places all classes according to the `propel.targetPackage` from the `build.properties`:
For instance, if no `package` attribute is defined at the database of table level, Propel places all classes according to the `propel.generator.targetPackage` from the *configuration file*:

* generated-classes/
* Base/
Expand All @@ -104,11 +105,7 @@ For instance, if no `package` attribute is defined at the database of table leve
* Review.php
* ReviewQuery.php

You can further tweak the location where Propel puts the created files by changing the `propel.output.dir` build property. By default this property is set to:

```ini
propel.output.dir = ${propel.project.dir}/build
```
You can further tweak the location where Propel puts the created files by changing the `propel.paths.outputDir` configuration property. By default this property is set to the current path (the path where you're running propel commands).

You can change it to use any other directory as your build directory.

Expand Down Expand Up @@ -170,15 +167,11 @@ And, as you probably expect it, a package overridden at the table level also acc
* book.schema.sql // contains CREATE TABLE book
* review.schema.sql // contains CREATE TABLE review

## Understanding The packageObjectModel Build Property ##
## Understanding The packageObjectModel Configuration Property ##

The `propel.packageObjectModel` build property enables the "packaged" build process. This modifies the build tasks behavior by joining `<database>` elements of the same name - but keeping their packages separate. That allows to split a large schema into several files, regardless of foreign key dependencies, since Propel will join all schemas using the same database name.
The `propel.generator.packageObjectModel` configuration property enables the "packaged" build process. This modifies the build tasks behavior by joining `<database>` elements of the same name - but keeping their packages separate. That allows to split a large schema into several files, regardless of foreign key dependencies, since Propel will join all schemas using the same database name.

To switch this on, simply add the following line to the `build.properties` file in your project directory:

```
propel.packageObjectModel = true
```
This property is enabled by default.

## The Bookstore Packaged Example ##

Expand Down
2 changes: 1 addition & 1 deletion cookbook/namespaces.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ In a schema, you can define a `package` attribute on a `<database>` or a `<table
namespace="Foo\Bar" package="Foo.Bar">
```

To avoid such repetitions, just set the `propel.namespace.autoPackage` setting to `true` in your `build.properties`:
To avoid such repetitions, just set the `propel.generator.schema.autoPackage` setting to `true` in your configuration file:

```ini
propel.namespace.autoPackage = true
Expand Down
Loading

0 comments on commit 2323790

Please sign in to comment.