unclecheese/silverstripe-superquery

A tool for running queries in the CMS

Installs: 25

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 2

Open Issues: 0

Language:JavaScript

Type:silverstripe-module

dev-master 2017-03-08 02:28 UTC

This package is auto-updated.

Last update: 2024-11-29 04:14:37 UTC


README

The power of raw queries, with the elegance of the ORM.

Installation

$ composer require unclecheese/sivlerstripe-superquery

Features

Run queries from within the CMS using the ORM, or SQL.

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()

Choose which columns you want displayed

Click on the Columns... button in the footer to bring up a panel allowing you to customise the view.

Export data to CSV or JSON

Click on the export buttons to export the data in its current state in JSON or CSV.

Save frequently used queries

Click Save... to give the query a name and store it in the "saved queries" dropdown.

Hang it anywhere

The API is decoupled from the CMS, meaning the tool can be installed anywhere in your project.

Security

Needless to say, running raw queries against your database is serious business. All actions are restricted to ADMIN.

Development

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.

Troubleshooting

Ring Uncle Cheese.