Database
#
DAOThe first step is to write a query in a DAO class. For instance:
src/api/src/Domain/Dao/UserDao.php
Here we have:
- A random filter, the
$search
string. - A predictable filter, the
$role
enum. - A sort direction and a sort column.
All the arguments are optional (= null
).
note
📣  If a parameter's value is null
, TDBM
automatically removes the corresponding conditions in the first argument of the find
method.
#
ResultIteratorThanks to the ResultIterator
class, you may retrieve a precise scope of the resulting data:
note
📣  Most of the time, you won't have to explicitly call the take
method
thanks to GraphQLite. More on that in the next chapter.
#
EnumThe folder src/api/src/Domain/Enum contains our enums.
Each enum's key (i.e., FIRST_NAME
) is a GraphQL value, while each enum's value (i.e., first_name
)
is a valid SQL expression.
Most enums are for:
- Sort by values.
- Business data.