php - User extended from FOSUserBundle causes unserialize() Error at offset at Easyadmin list -
i use 1.16.10 version of easyadminbundle. created user entity, extended fosuser's model (as in documentation) , added easyadmin configuration file. result got following error:
an exception has been thrown during rendering of template ("notice: unserialize(): error @ offset 0 of 34 bytes").
the full description stack trace:
critical - uncaught php exception twig_error_runtime: "an exception has been thrown during rendering of template ("notice: unserialize(): error @ offset 0 of 34 bytes")." @ \vendor\javiereguiluz\easyadmin-bundle\resources\views\default\list.html.twig line 132
so, code of entity:
namespace backofficebundle\entity; use doctrine\orm\mapping orm; use fos\userbundle\model\user baseuser; use gedmo\mapping\annotation gedmo; /** * acluser * * @orm\entity(repositoryclass="backofficebundle\repository\acluserrepository") * @orm\table(name="acl_user") */ class acluser extends baseuser { /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @var string * * @orm\column(name="ip_address", type="string", length=255, nullable=true) */ private $ipaddress; /** * @var boolean * * @orm\column(name="locked", type="boolean") */ private $locked = false; /** * @orm\column(name="expired", type="boolean") */ private $expired = false; /** * @orm\column(name="expires_at", type="datetime", nullable=true) */ private $expiresat; /** * @orm\column(name="credentials_expired", type="boolean", nullable=true) */ private $credentialsexpired; /** * @orm\column(name="credentials_expire_at", type="datetime", nullable=true) */ private $credentialsexpireat; /** * @var \datetime * * @orm\column(name="created_at", type="datetime", nullable=false) */ private $createdat; /** * @var \datetime * * @gedmo\timestampable(on="update") * * @orm\column(name="updated_at", type="datetime", nullable=false) */ private $updatedat; public function __construct() { parent::__construct(); $this->createdat = new \datetime('now'); } /** generated getters , setters **/ }`
my user.yml file, imported config.yml:
easy_admin: entities: user: class: backofficebundle\entity\acluser list: fields: - id - username - email - enabled - lastlogin - { property: roles, type: json_array, template: '@backofficebundle/resources/views/fields/role.html.twig' } form: fields: - username - email - enabled - lastlogin - { property: 'plainpassword', type: 'text', type_options: { required: false } } - { property: 'roles', type: 'choice', type_options: { multiple: true, choices: { 'role_app_super_admin' : 'role_app_admin', 'role_app_admin' : 'role_app_user', 'role_app_user' : 'role_user' } } }`
what did wrong? causes error? how can solve it?
fos userbundle's base user-model contains serialize , unserialize outputs model's properties array , calls serialize on , deserializes , sets array again.
my assumption either renamed of properties or try load model contains data can not handled unserialize, e.g. because data truncated @ point or weird that. might want clear old sessions, because far know serialize/unserialize used storing data in session or might want start debugging looking @ serialized data tries unserialize.
Comments
Post a Comment