The power of raw queries, with the elegance of the ORM.
$ composer require unclecheese/sivlerstripe-superquery
Use the _('YourClassName')
as a replacement for YourClassName::get()
, and use Symfony's
expression language for the rest. (Spoiler: it's so dead simple, you already understand it).
Examples:
_('File').filter('Created:LessThan', '2015-01-01')
_('Member').filter({'Email:PartialMatch': 'hotmail.com', 'Active': true}).sort('Created DESC')
_('Event').filter('Approved', true).relation('Sponsors').sort('CompanyName ASC')
_('Event').filter('Approved', false).removeAll()
Click on the Columns...
button in the footer to bring up a panel allowing you to customise the view.
Click on the export buttons to export the data in its current state in JSON or CSV.
Click Save...
to give the query a name and store it in the "saved queries" dropdown.
The API is decoupled from the CMS, meaning the tool can be installed anywhere in your project.
Needless to say, running raw queries against your database is serious business. All actions are restricted to ADMIN
.
The tool is built on ReactJS using the Webpack module builder. To do dev work:
- Run
npm run start
in the module root directory. - Visit the
admin/superquery
URL directly in your browser. Navigating to it from with in the CMS will not properly load the dev server.
For realeases / Pull requests:
- Run
npm run build
from the module root directory.
Ring Uncle Cheese.