Skip to content

Instantly share code, notes, and snippets.

@jenkoian
Last active February 3, 2016 12:57
Show Gist options
  • Save jenkoian/33e87298a93f5eb17f02 to your computer and use it in GitHub Desktop.
Save jenkoian/33e87298a93f5eb17f02 to your computer and use it in GitHub Desktop.
Legacy escape route mapRolesSnippet.php
<?php
// ...
/**
* Map legacy roles to symfony roles. Legacy roles are in following format:
* ['moderator' => '1']
*/
private function mapRoles()
{
if (empty($this->legacyRoles)) {
return;
}
foreach ($this->legacyRoles as $roleName => $roleValue) {
if ($roleValue === '1') {
$this->roles[] = 'ROLE_' . strtoupper($roleName);
}
}
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment