php - Silex login and retrieve ID -
php - Silex login and retrieve ID -
i have basic silex login process , running user coming database.
the database table utilize contains more info want readily available logged in session, can't find "where set it". symfony\component\security\core\user\user has few fields username, password, salt, provides no method store more info against object.
the alternative thought store info in separate db tables, unable retrieve id of database row of logged in user, cannot link other tables user. little reluctant have both user table , table using 'username' identifier.
i must doing wrong, need little help.
update: should add together used userprovider detailed here: http://silex.sensiolabs.org/doc/providers/security.html#defining-a-custom-user-provider
you can utilize custom user class in userprovider
// userprovider file <?php namespace x; utilize yournamespace/yourcustomuser; ... public function loaduserbyusername($username) { ... homecoming yourcustomuser(...); }
note according http://silex.sensiolabs.org/doc/providers/security.html#defining-a-custom-user-provider yourcustomuser should implement symfony\component\security\core\user\userinterface:
// yourcustomuser file <?php ... utilize symfony\component\security\core\user\userinterface; ... class yourcustomuser implements userinterface { /* add together custom properties here, e.g. phone_number */ }
php symfony2 silex
Comments
Post a Comment