Extending / Storage Layer / Working with Handlers
Note: You are currently reading the documentation for Bolt 3.7. Looking for the documentation for Bolt 5.2 instead?
Overview¶
Handlers are short segments of code that include an __invoke
statement and
executes queries. It is called to not only manipulate the query, but
run the query and return a result set. If you are wanting to just manipulate the query,
please look at the documentation for directives
.
Examples of a handler would be for pagination, searching, or selecting data from
the database.
Lets take a look at an example:
You can add the new handler by registering it with your parser. This can be done by the following code:
Then you can run the handler by $app['query']->getContent("pages/select");
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.