Skip to content

Cannot assign string to property App\Entity\User::$roles of type array! #42688

Answered by zspine
karaka200 asked this question in Q&A
Discussion options

You must be logged in to vote

@karaka200 Ensure you are not trying to set a string value for the array property. For example:

$this->roles = 'ROLE_ADMIN';

it should be

$this->roles[] = 'ROLE_ADMIN';

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@karaka200
Comment options

@karaka200
Comment options

@zspine
Comment options

@karaka200
Comment options

@zspine
Comment options

Answer selected by lyrixx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants