i try to find a faster way to generate UI for existing database, CRUD, composer way, using symfony component.
found CRUDlex. Doing install with composer, also setup CRUDlex sample it works fine, until i m add new table definition in sample crud.yml
category:
label: Category
table: category
fields:
name:
type: text
label: Name
required: true
unique: true
what ever table added in yml, it's always throw error similar to this when access http://localhost/crudlex/web/category
InvalidFieldNameException in AbstractMySQLDriver.php line 71: An exception occurred while executing 'SELECT COUNT(id) FROM `category` `category` WHERE deleted_at IS NULL':
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'deleted_at' in 'where clause'
complete error message please check screenshot below
crudlex always asking "id" and 'deleted_at'
the code is same as CRUDled sample index.php
$loader = require __DIR__.'/../vendor/autoload.php';
//$loader->add('CRUDlex', __DIR__.'/../../CRUDlex/src');
$app = new Silex\Application();
$app['debug'] = true;
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
'dbs.options' => array(
'default' => array(
'host' => '127.0.0.1',
'dbname' => 'dbname',
'user' => 'root',
'password' => '',
'charset' => 'utf8',
)
),
));
$app->register(new Silex\Provider\SessionServiceProvider());
$dataFactory = new CRUDlex\MySQLDataFactory($app['db']);
$app->register(new CRUDlex\ServiceProvider(), array(
'crud.file' => __DIR__ . '/../crud.yml',
'crud.datafactory' => $dataFactory
));
$app->register(new Silex\Provider\TwigServiceProvider());
//$app['crud.layout'] = 'layout.twig';
$app->mount('/', new CRUDlex\ControllerProvider());
$app->match('/', function() use ($app) {
return $app->redirect($app['url_generator']->generate('crudList', array('entity' => 'library')));
})->bind('homepage');
$app->run();
And folder structure
vendor
web
> .htaccess
> index.php
composer.json
crud.yml
Note: I m totally new to silex and symfony2 component ^_^ Thank you, any suggest really appreciated
you are missing (at least) one of the required meta fields:
The complete table creation SQL in your case would look like this: