Updated doc

This commit is contained in:
William DURAND 2011-06-22 17:38:12 +02:00
parent e27dc9cbd5
commit 06b5f2783d
3 changed files with 276 additions and 213 deletions

View file

@ -35,27 +35,31 @@ Installation
* Register this bundle in the `AppKernel` class: * Register this bundle in the `AppKernel` class:
public function registerBundles() ``` php
{ public function registerBundles()
$bundles = array( {
... $bundles = array(
...
// PropelBundle // PropelBundle
new Propel\PropelBundle\PropelBundle(), new Propel\PropelBundle\PropelBundle(),
// register your bundles // register your bundles
new Sensio\HelloBundle\HelloBundle(), new Sensio\HelloBundle\HelloBundle(),
); );
... ...
} }
```
* Don't forget to register the PropelBundle namespace in `app/autoload.php`: * Don't forget to register the PropelBundle namespace in `app/autoload.php`:
$loader->registerNamespaces(array( ``` php
... $loader->registerNamespaces(array(
...
'Propel' => __DIR__.'/../vendor/bundles', 'Propel' => __DIR__.'/../vendor/bundles',
)); ));
```
Sample Configuration Sample Configuration
@ -63,34 +67,36 @@ Sample Configuration
### Project configuration ### Project configuration
# in app/config/config.yml ``` yaml
propel: # in app/config/config.yml
path: "%kernel.root_dir%/../vendor/propel" propel:
phing_path: "%kernel.root_dir%/../vendor/phing" path: "%kernel.root_dir%/../vendor/propel"
# charset: "UTF8" phing_path: "%kernel.root_dir%/../vendor/phing"
# logging: %kernel.debug% # charset: "UTF8"
# build_properties: # logging: %kernel.debug%
# xxxxx.xxxxx: xxxxxx # build_properties:
# xxxxx.xxxxx: xxxxxx # xxxxx.xxxxx: xxxxxx
# xxxxx.xxxxx: xxxxxx
# in app/config/config*.yml # in app/config/config*.yml
propel: propel:
dbal: dbal:
driver: mysql driver: mysql
user: root user: root
password: null password: null
dsn: mysql:host=localhost;dbname=test dsn: mysql:host=localhost;dbname=test
options: {} options: {}
attributes: {} attributes: {}
# default_connection: default # default_connection: default
# connections: # connections:
# default: # default:
# driver: mysql # driver: mysql
# user: root # user: root
# password: null # password: null
# dsn: mysql:host=localhost;dbname=test # dsn: mysql:host=localhost;dbname=test
# options: {} # options: {}
# attributes: {} # attributes: {}
```
### Build properties ### Build properties
@ -102,38 +108,42 @@ You can define _build properties_ by creating a `propel.ini` file in `app/config
But you can follow the Symfony2 way by adding build properties in `app/config/config.yml`: But you can follow the Symfony2 way by adding build properties in `app/config/config.yml`:
# in app/config/config.yml ``` yaml
propel: # in app/config/config.yml
build_properties: propel:
xxxxx.xxxx.xxxxx: XXXX build_properties:
xxxxx.xxxx.xxxxx: XXXX xxxxx.xxxx.xxxxx: XXXX
... xxxxx.xxxx.xxxxx: XXXX
...
```
### Sample Schema ### Sample Schema
Place the following schema in `src/Sensio/HelloBundle/Resources/config/schema.xml` : Place the following schema in `src/Sensio/HelloBundle/Resources/config/schema.xml` :
<?xml version="1.0" encoding="UTF-8"?> ``` xml
<database name="default" namespace="Sensio\HelloBundle\Model" defaultIdMethod="native"> <?xml version="1.0" encoding="UTF-8"?>
<database name="default" namespace="Sensio\HelloBundle\Model" defaultIdMethod="native">
<table name="book"> <table name="book">
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" /> <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
<column name="title" type="varchar" primaryString="1" size="100" /> <column name="title" type="varchar" primaryString="1" size="100" />
<column name="ISBN" type="varchar" size="20" /> <column name="ISBN" type="varchar" size="20" />
<column name="author_id" type="integer" /> <column name="author_id" type="integer" />
<foreign-key foreignTable="author"> <foreign-key foreignTable="author">
<reference local="author_id" foreign="id" /> <reference local="author_id" foreign="id" />
</foreign-key> </foreign-key>
</table> </table>
<table name="author"> <table name="author">
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" /> <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
<column name="first_name" type="varchar" size="100" /> <column name="first_name" type="varchar" size="100" />
<column name="last_name" type="varchar" size="100" /> <column name="last_name" type="varchar" size="100" />
</table> </table>
</database> </database>
```
Commands Commands
@ -234,10 +244,12 @@ If none of this parameter are set all files, XML and SQL, in the directory will
A valid _XML fixtures file_ is: A valid _XML fixtures file_ is:
<?xml version="1.0" encoding="utf-8"?> ``` xml
<dataset name="all"> <?xml version="1.0" encoding="utf-8"?>
<Object Id="..." /> <dataset name="all">
</dataset> <Object Id="..." />
</dataset>
```
### Graphviz ### Graphviz
@ -251,13 +263,22 @@ It will write files in `app/propel/graph/`.
### Database ### Database
You can drop a **database**: You can create a **database**:
> php app/console propel:database:drop > php app/console propel:database:create [--connection[=""]]
As usual, `--connection` allows to specify a connection. As usual, `--connection` allows to specify a connection.
You can drop a **database**:
> php app/console propel:database:drop [--connection[=""]] [--force]
As usual, `--connection` allows to specify a connection.
Note that the `--force` option is needed to actually execute the SQL statements.
Known Problems Known Problems
-------------- --------------

View file

@ -35,27 +35,31 @@ Installation
* Register this bundle in the `AppKernel` class: * Register this bundle in the `AppKernel` class:
public function registerBundles() ``` php
{ public function registerBundles()
$bundles = array( {
... $bundles = array(
...
// PropelBundle // PropelBundle
new Propel\PropelBundle\PropelBundle(), new Propel\PropelBundle\PropelBundle(),
// register your bundles // register your bundles
new Sensio\HelloBundle\HelloBundle(), new Sensio\HelloBundle\HelloBundle(),
); );
... ...
} }
```
* Don't forget to register the PropelBundle namespace in `app/autoload.php`: * Don't forget to register the PropelBundle namespace in `app/autoload.php`:
$loader->registerNamespaces(array( ``` php
... $loader->registerNamespaces(array(
...
'Propel' => __DIR__.'/../vendor/bundles', 'Propel' => __DIR__.'/../vendor/bundles',
)); ));
```
Sample Configuration Sample Configuration
@ -63,34 +67,36 @@ Sample Configuration
### Project configuration ### Project configuration
# in app/config/config.yml ``` yaml
propel: # in app/config/config.yml
path: "%kernel.root_dir%/../vendor/propel" propel:
phing_path: "%kernel.root_dir%/../vendor/phing" path: "%kernel.root_dir%/../vendor/propel"
# charset: "UTF8" phing_path: "%kernel.root_dir%/../vendor/phing"
# logging: %kernel.debug% # charset: "UTF8"
# build_properties: # logging: %kernel.debug%
# xxxxx.xxxxx: xxxxxx # build_properties:
# xxxxx.xxxxx: xxxxxx # xxxxx.xxxxx: xxxxxx
# xxxxx.xxxxx: xxxxxx
# in app/config/config*.yml # in app/config/config*.yml
propel: propel:
dbal: dbal:
driver: mysql driver: mysql
user: root user: root
password: null password: null
dsn: mysql:host=localhost;dbname=test dsn: mysql:host=localhost;dbname=test
options: {} options: {}
attributes: {} attributes: {}
# default_connection: default # default_connection: default
# connections: # connections:
# default: # default:
# driver: mysql # driver: mysql
# user: root # user: root
# password: null # password: null
# dsn: mysql:host=localhost;dbname=test # dsn: mysql:host=localhost;dbname=test
# options: {} # options: {}
# attributes: {} # attributes: {}
```
### Build properties ### Build properties
@ -102,38 +108,42 @@ You can define _build properties_ by creating a `propel.ini` file in `app/config
But you can follow the Symfony2 way by adding build properties in `app/config/config.yml`: But you can follow the Symfony2 way by adding build properties in `app/config/config.yml`:
# in app/config/config.yml ``` yaml
propel: # in app/config/config.yml
build_properties: propel:
xxxxx.xxxx.xxxxx: XXXX build_properties:
xxxxx.xxxx.xxxxx: XXXX xxxxx.xxxx.xxxxx: XXXX
... xxxxx.xxxx.xxxxx: XXXX
...
```
### Sample Schema ### Sample Schema
Place the following schema in `src/Sensio/HelloBundle/Resources/config/schema.xml` : Place the following schema in `src/Sensio/HelloBundle/Resources/config/schema.xml` :
<?xml version="1.0" encoding="UTF-8"?> ``` xml
<database name="default" namespace="Sensio\HelloBundle\Model" defaultIdMethod="native"> <?xml version="1.0" encoding="UTF-8"?>
<database name="default" namespace="Sensio\HelloBundle\Model" defaultIdMethod="native">
<table name="book"> <table name="book">
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" /> <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
<column name="title" type="varchar" primaryString="1" size="100" /> <column name="title" type="varchar" primaryString="1" size="100" />
<column name="ISBN" type="varchar" size="20" /> <column name="ISBN" type="varchar" size="20" />
<column name="author_id" type="integer" /> <column name="author_id" type="integer" />
<foreign-key foreignTable="author"> <foreign-key foreignTable="author">
<reference local="author_id" foreign="id" /> <reference local="author_id" foreign="id" />
</foreign-key> </foreign-key>
</table> </table>
<table name="author"> <table name="author">
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" /> <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
<column name="first_name" type="varchar" size="100" /> <column name="first_name" type="varchar" size="100" />
<column name="last_name" type="varchar" size="100" /> <column name="last_name" type="varchar" size="100" />
</table> </table>
</database> </database>
```
Commands Commands
@ -234,10 +244,12 @@ If none of this parameter are set all files, XML and SQL, in the directory will
A valid _XML fixtures file_ is: A valid _XML fixtures file_ is:
<?xml version="1.0" encoding="utf-8"?> ``` xml
<dataset name="all"> <?xml version="1.0" encoding="utf-8"?>
<Object Id="..." /> <dataset name="all">
</dataset> <Object Id="..." />
</dataset>
```
### Graphviz ### Graphviz
@ -251,13 +263,22 @@ It will write files in `app/propel/graph/`.
### Database ### Database
You can drop a **database**: You can create a **database**:
> php app/console propel:database:drop > php app/console propel:database:create [--connection[=""]]
As usual, `--connection` allows to specify a connection. As usual, `--connection` allows to specify a connection.
You can drop a **database**:
> php app/console propel:database:drop [--connection[=""]] [--force]
As usual, `--connection` allows to specify a connection.
Note that the `--force` option is needed to actually execute the SQL statements.
Known Problems Known Problems
-------------- --------------

View file

@ -35,27 +35,31 @@ Installation
* Register this bundle in the `AppKernel` class: * Register this bundle in the `AppKernel` class:
public function registerBundles() ``` php
{ public function registerBundles()
$bundles = array( {
... $bundles = array(
...
// PropelBundle // PropelBundle
new Propel\PropelBundle\PropelBundle(), new Propel\PropelBundle\PropelBundle(),
// register your bundles // register your bundles
new Sensio\HelloBundle\HelloBundle(), new Sensio\HelloBundle\HelloBundle(),
); );
... ...
} }
```
* Don't forget to register the PropelBundle namespace in `app/autoload.php`: * Don't forget to register the PropelBundle namespace in `app/autoload.php`:
$loader->registerNamespaces(array( ``` php
... $loader->registerNamespaces(array(
...
'Propel' => __DIR__.'/../vendor/bundles', 'Propel' => __DIR__.'/../vendor/bundles',
)); ));
```
Sample Configuration Sample Configuration
@ -63,34 +67,36 @@ Sample Configuration
### Project configuration ### Project configuration
# in app/config/config.yml ``` yaml
propel: # in app/config/config.yml
path: "%kernel.root_dir%/../vendor/propel" propel:
phing_path: "%kernel.root_dir%/../vendor/phing" path: "%kernel.root_dir%/../vendor/propel"
# charset: "UTF8" phing_path: "%kernel.root_dir%/../vendor/phing"
# logging: %kernel.debug% # charset: "UTF8"
# build_properties: # logging: %kernel.debug%
# xxxxx.xxxxx: xxxxxx # build_properties:
# xxxxx.xxxxx: xxxxxx # xxxxx.xxxxx: xxxxxx
# xxxxx.xxxxx: xxxxxx
# in app/config/config*.yml # in app/config/config*.yml
propel: propel:
dbal: dbal:
driver: mysql driver: mysql
user: root user: root
password: null password: null
dsn: mysql:host=localhost;dbname=test dsn: mysql:host=localhost;dbname=test
options: {} options: {}
attributes: {} attributes: {}
# default_connection: default # default_connection: default
# connections: # connections:
# default: # default:
# driver: mysql # driver: mysql
# user: root # user: root
# password: null # password: null
# dsn: mysql:host=localhost;dbname=test # dsn: mysql:host=localhost;dbname=test
# options: {} # options: {}
# attributes: {} # attributes: {}
```
### Build properties ### Build properties
@ -102,38 +108,42 @@ You can define _build properties_ by creating a `propel.ini` file in `app/config
But you can follow the Symfony2 way by adding build properties in `app/config/config.yml`: But you can follow the Symfony2 way by adding build properties in `app/config/config.yml`:
# in app/config/config.yml ``` yaml
propel: # in app/config/config.yml
build_properties: propel:
xxxxx.xxxx.xxxxx: XXXX build_properties:
xxxxx.xxxx.xxxxx: XXXX xxxxx.xxxx.xxxxx: XXXX
... xxxxx.xxxx.xxxxx: XXXX
...
```
### Sample Schema ### Sample Schema
Place the following schema in `src/Sensio/HelloBundle/Resources/config/schema.xml` : Place the following schema in `src/Sensio/HelloBundle/Resources/config/schema.xml` :
<?xml version="1.0" encoding="UTF-8"?> ``` xml
<database name="default" namespace="Sensio\HelloBundle\Model" defaultIdMethod="native"> <?xml version="1.0" encoding="UTF-8"?>
<database name="default" namespace="Sensio\HelloBundle\Model" defaultIdMethod="native">
<table name="book"> <table name="book">
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" /> <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
<column name="title" type="varchar" primaryString="1" size="100" /> <column name="title" type="varchar" primaryString="1" size="100" />
<column name="ISBN" type="varchar" size="20" /> <column name="ISBN" type="varchar" size="20" />
<column name="author_id" type="integer" /> <column name="author_id" type="integer" />
<foreign-key foreignTable="author"> <foreign-key foreignTable="author">
<reference local="author_id" foreign="id" /> <reference local="author_id" foreign="id" />
</foreign-key> </foreign-key>
</table> </table>
<table name="author"> <table name="author">
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" /> <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
<column name="first_name" type="varchar" size="100" /> <column name="first_name" type="varchar" size="100" />
<column name="last_name" type="varchar" size="100" /> <column name="last_name" type="varchar" size="100" />
</table> </table>
</database> </database>
```
Commands Commands
@ -234,10 +244,12 @@ If none of this parameter are set all files, XML and SQL, in the directory will
A valid _XML fixtures file_ is: A valid _XML fixtures file_ is:
<?xml version="1.0" encoding="utf-8"?> ``` xml
<dataset name="all"> <?xml version="1.0" encoding="utf-8"?>
<Object Id="..." /> <dataset name="all">
</dataset> <Object Id="..." />
</dataset>
```
### Graphviz ### Graphviz
@ -251,13 +263,22 @@ It will write files in `app/propel/graph/`.
### Database ### Database
You can drop a **database**: You can create a **database**:
> php app/console propel:database:drop > php app/console propel:database:create [--connection[=""]]
As usual, `--connection` allows to specify a connection. As usual, `--connection` allows to specify a connection.
You can drop a **database**:
> php app/console propel:database:drop [--connection[=""]] [--force]
As usual, `--connection` allows to specify a connection.
Note that the `--force` option is needed to actually execute the SQL statements.
Known Problems Known Problems
-------------- --------------