Skip to content

Commit 7e59884

Browse files
committed
[doctrine] adding a rew more repo methods and fixing bad doc ref
1 parent 8f338ae commit 7e59884

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

book/doctrine.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,18 @@ Once you have your repository, you have access to all sorts of helpful methods::
443443
Of course, you can also issue complex queries, which you'll learn more
444444
about in the :ref:`book-doctrine-queries` section.
445445

446+
You can also take advantage of the useful ``findBy`` and ``findOneBy`` methods
447+
to easily fetch objects based on multiple conditions::
448+
449+
// query for one product matching be name and price
450+
$product = $repository->findOneBy(array('name' => 'foo', 'price' => 19.99));
451+
452+
// query for all prdocuts matching the name, ordered by price
453+
$product = $repository->findBy(
454+
array('name' => 'foo'),
455+
array('price', 'ASC')
456+
);
457+
446458
.. tip::
447459

448460
When you render any page, you can see how many queries were made in the

cookbook/doctrine/doctrine_fixtures.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Fixtures are used to load a controlled set of data into a database. This data
88
can be used for testing or could be the initial data required for the
99
application to run smoothly. Symfony2 has no built in way to manage fixtures
1010
but Doctrine2 has a library to help you write fixtures for the Doctrine
11-
:doc:`ORM</book/doctrine/orm>` or :doc:`ODM</cookbook/doctrine/mongodb>`.
11+
:doc:`ORM</book/doctrine>` or :doc:`ODM</cookbook/doctrine/mongodb>`.
1212

1313
Setup and Configuration
1414
-----------------------

0 commit comments

Comments
 (0)