DataTables Editor installed via Composer
DataTables Editor installed via Composer
![scratcher](https://secure.gravatar.com/avatar/91ce941bb48f0fcaa5d601e4df24ec5a/?default=https%3A%2F%2Fvanillicon.com%2F91ce941bb48f0fcaa5d601e4df24ec5a_200.png&rating=g&size=120)
How to use DataTables Editor installed via Composer?
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
require '../config.php';
require '../vendor/autoload.php';
Editor::inst( $db, 'filters' )
->fields(
...
and getting errors like: Uncaught Error: Call to a member function transaction() on null, because $db is NULL.
This question has an accepted answers - jump to answer
Answers
Hi,
When you do a Composer install, you need to make the database connection yourself. As you'll see in the documentation that is typically something like:
You could put that into
config.php
if you want to to allow it to be shared between files.Allan
Thanks, Allan!