Skip to content

Commit

Permalink
[#6360] Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Mar 17, 2016
1 parent 8883dfe commit 10d19ba
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions book/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,8 @@ directly inside the ``Product`` class via DocBlock annotations:

.. tip::

The table name annotation is optional. If it's omitted, Doctrine will
assume that the entity's class name should double as the database table
name. In the example above, an explicit definition was provided to force
the table name to be lowercased.
The table name is optional and if omitted, will be determined automatically
based on the name of the entity class.

Doctrine allows you to choose from a wide variety of different field types,
each with their own options. For information on the available field types,
Expand All @@ -362,7 +360,7 @@ see the :ref:`book-doctrine-field-types` section.
Be careful if the names of your entity classes (or their properties)
are also reserved SQL keywords like ``GROUP`` or ``USER``. For example,
if your entity's class name is ``Group``, then, by default, the corresponding
table name would be ``Group``. This will cause an SQL error in some database
table name would be ``group``. This will cause an SQL error in some database
engines. See Doctrine's `Reserved SQL keywords documentation`_ for details
on how to properly escape these names. Alternatively, if you're free
to choose your database schema, simply map to a different table name
Expand Down Expand Up @@ -507,10 +505,10 @@ a controller, this is pretty easy. Add the following method to the

$em = $this->getDoctrine()->getManager();

// register the Product entity with Doctrine's entity manager.
// tells Doctrine you want to (eventually) save the Product (no queries yet)
$em->persist($product);

// synchronize all the registered entities with the database.
// actually executes the queries (i.e. the INSERT query)
$em->flush();

return new Response('Saved new product with id '.$product->getId());
Expand Down

1 comment on commit 10d19ba

@natechicago
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff! Thanks for the review & merge of #6360. I have another batch of similar changes, aimed at the 2nd half of the Doctrine chapter, which I'll be submitting independently. I probably could've included those in the original PR, but I didn't want the changeset for that one too be too overwhelming!

Please sign in to comment.