Skip to content

Commit 957b8a1

Browse files
committed
Merge branch '2.0' into 2.1
Conflicts: book/propel.rst
2 parents ce77e1a + 6c083c8 commit 957b8a1

File tree

1 file changed

+38
-19
lines changed

1 file changed

+38
-19
lines changed

book/propel.rst

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Databases and Propel
77
One of the most common and challenging tasks for any application
88
involves persisting and reading information to and from a database. Symfony2
99
does not come integrated with any ORMs but the Propel integration is easy.
10-
To get started, read `Working With Symfony2`_.
10+
To install Propel, read `Working With Symfony2`_ on the Propel documentation.
1111

1212
A Simple Example: A Product
1313
---------------------------
@@ -28,7 +28,7 @@ Configuring the Database
2828
~~~~~~~~~~~~~~~~~~~~~~~~
2929

3030
Before you can start, you'll need to configure your database connection
31-
information. By convention, this information is usually configured in an
31+
information. By convention, this information is usually configured in an
3232
``app/config/parameters.yml`` file:
3333

3434
.. code-block:: yaml
@@ -48,14 +48,17 @@ information. By convention, this information is usually configured in an
4848
parameters defined in that file are referenced by the main configuration
4949
file when setting up Propel:
5050

51-
.. code-block:: yaml
51+
These parameters defined in ``parameters.yml`` can now be included in the
52+
configuration file (``config.yml``):
5253

53-
propel:
54-
dbal:
55-
driver: "%database_driver%"
56-
user: "%database_user%"
57-
password: "%database_password%"
58-
dsn: "%database_driver%:host=%database_host%;dbname=%database_name%;charset=%database_charset%"
54+
.. code-block:: yaml
55+
56+
propel:
57+
dbal:
58+
driver: "%database_driver%"
59+
user: "%database_user%"
60+
password: "%database_password%"
61+
dsn: "%database_driver%:host=%database_host%;dbname=%database_name%;charset=%database_charset%"
5962
6063
Now that Propel knows about your database, Symfony2 can create the database for
6164
you:
@@ -88,12 +91,28 @@ of your ``AcmeStoreBundle``:
8891
.. code-block:: xml
8992
9093
<?xml version="1.0" encoding="UTF-8"?>
91-
<database name="default" namespace="Acme\StoreBundle\Model" defaultIdMethod="native">
94+
<database name="default"
95+
namespace="Acme\StoreBundle\Model"
96+
defaultIdMethod="native"
97+
>
9298
<table name="product">
93-
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
94-
<column name="name" type="varchar" primaryString="true" size="100" />
95-
<column name="price" type="decimal" />
96-
<column name="description" type="longvarchar" />
99+
<column name="id"
100+
type="integer"
101+
required="true"
102+
primaryKey="true"
103+
autoIncrement="true"
104+
/>
105+
<column name="name"
106+
type="varchar"
107+
primaryString="true"
108+
size="100"
109+
/>
110+
<column name="price"
111+
type="decimal"
112+
/>
113+
<column name="description"
114+
type="longvarchar"
115+
/>
97116
</table>
98117
</database>
99118
@@ -217,15 +236,15 @@ have a route that maps a product id to an update action in a controller::
217236

218237
Updating an object involves just three steps:
219238

220-
#. fetching the object from Propel;
221-
#. modifying the object;
222-
#. saving it.
239+
#. fetching the object from Propel (line 6 - 13);
240+
#. modifying the object (line 15);
241+
#. saving it (line 16).
223242

224243
Deleting an Object
225244
~~~~~~~~~~~~~~~~~~
226245

227-
Deleting an object is very similar, but requires a call to the ``delete()``
228-
method on the object::
246+
Deleting an object is very similar to updating, but requires a call to the
247+
``delete()`` method on the object::
229248

230249
$product->delete();
231250

0 commit comments

Comments
 (0)