jasongrimes/silex-simpleuser

Changeable SQL Column Names

Closed this issue · 2 comments

Currently it appears to me that the only way to change the column names is to extend and partially rewrite the UserManager because the column names are written in there.

Would you like me to rewrite parts of the UserManager to include this modularity so that Column names can be defined like:

$app['user.options'] = array(
    'userColumns' => array(
        'id' => 'my_column_name',
        'email' => 'my_column_name',
        'password' => 'my_column_name',
        'salt' => 'my_column_name',
        'roles' => 'my_column_name',
        'name' => 'my_column_name',
        'time_created' => 'my_column_name',
        'username' => 'my_column_name',
        'isEnabled' => 'my_column_name',
        'confirmationToken' => 'my_column_name',
        'timePasswordResetRequested' => 'my_column_name'
    )
);

Hi Ryan,

That change sounds fine to me, with a couple caveats:

  • Make sure that it doesn't break anything for existing installations, or inconvenience people who don't want to customize column names. I.e. this configuration should be optional, and the defaults should work as they do now.
  • Make sure to safely escape the column name variables in the SQL.

Thanks!

Merged. Thanks!