DQL (Doctrine Query Language) - Conditional expressions - Literals.php 895 Bytes
Newer Older
hansbrix's avatar
hansbrix committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
**Strings**


A string literal is enclosed in single quotesfor example: 'literal'. A string literal that includes a single
quote is represented by two single quotesfor example: 'literal''s'.
<code>
FROM User WHERE User.name = 'Vincent'
</code>

**Integers**

Integer literals support the use of PHP integer literal syntax.
<code>
FROM User WHERE User.id = 4
</code>

**Floats**

Float literals support the use of PHP float literal syntax.
<code>
FROM Account WHERE Account.amount = 432.123
</code>



**Booleans**

The boolean literals are true and false.

<code>
FROM User WHERE User.admin = true

FROM Session WHERE Session.is_authed = false
</code>



**Enums**

The enumerated values work in the same way as string literals.

<code>
FROM User WHERE User.type = 'admin'
</code>



Predefined reserved literals are case insensitive, although its a good standard to write them in uppercase.
49