Skip to content

Commit 7ba150f

Browse files
committed
Deprecate repositories' magic findBy and findOneBy
1 parent 87aba02 commit 7ba150f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

docs/en/reference/document-repositories.rst

+5
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ with Doctrine's Criteria API.
4646

4747
All above methods will include additional criteria specified by :ref:`Filters <filters>`.
4848

49+
.. note::
50+
51+
Magic ``findBy`` and ``findOneBy`` calls described below are deprecated in 1.2 and
52+
will be removed in 2.0.
53+
4954
Additional methods that are not defined explicitly in the repository class may also be
5055
used if they follow a specific naming convention:
5156

lib/Doctrine/ODM/MongoDB/DocumentRepository.php

+6
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,15 @@ public function findOneBy(array $criteria)
206206
* or no find* method at all and therefore an invalid
207207
* method call.
208208
* @return array|object The found document/documents.
209+
*
210+
* @deprecated method was deprecated in 1.2 and will be removed in 2.0
209211
*/
210212
public function __call($method, $arguments)
211213
{
214+
@trigger_error(
215+
'Using magic findBy and findOneBy calls was deprecated in version 1.2 and will be removed altogether in 2.0.',
216+
E_USER_DEPRECATED
217+
);
212218
if (strpos($method, 'findBy') === 0) {
213219
$by = substr($method, 6, strlen($method));
214220
$method = 'findBy';

0 commit comments

Comments
 (0)