mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fix #8829: mention get_one does not escape field names
This commit is contained in:
parent
cb8ec9ae1d
commit
252397d8d1
@ -3154,9 +3154,14 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
* Return the first item matching the given query.
|
||||
* All calls to get_one() are cached.
|
||||
*
|
||||
* The filter argument supports parameterised queries (see SQLSelect::addWhere() for syntax examples). Because
|
||||
* of that (and differently from e.g. DataList::filter()) you need to manually escape the field names:
|
||||
* <code>
|
||||
* $member = DataObject::get_one('Member', [ '"FirstName"' => 'John' ]);
|
||||
* </code>
|
||||
*
|
||||
* @param string $callerClass The class of objects to be returned
|
||||
* @param string|array $filter A filter to be inserted into the WHERE clause.
|
||||
* Supports parameterised queries. See SQLSelect::addWhere() for syntax examples.
|
||||
* @param boolean $cache Use caching
|
||||
* @param string $orderby A sort expression to be inserted into the ORDER BY clause.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user