/**
  * Transform a given mode security identity into an ACL related SecurityIdentity.
  *
  * @param \Propel\PropelBundle\Model\Acl\SecurityIdentity $securityIdentity
  *
  * @return \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface
  */
 public static function toAclIdentity(SecurityIdentity $securityIdentity)
 {
     $identifier = $securityIdentity->getIdentifier();
     if ($securityIdentity->getUsername()) {
         if (false === strpos($identifier, '-')) {
             throw new \InvalidArgumentException('The given identifier does not resolve to a UserSecurityIdentity.');
         }
         list($class, $username) = explode('-', $identifier, 2);
         return new UserSecurityIdentity($username, $class);
     }
     if (0 === strpos($identifier, 'ROLE_') or 0 === strpos($identifier, 'IS_AUTHENTICATED_')) {
         return new RoleSecurityIdentity($identifier);
     }
     throw new \InvalidArgumentException('The security identity does not resolve to either UserSecurityIdentity or RoleSecurityIdentity.');
 }