I have an entity related with some object in many-to-many relation (well, not really a relation because I have a table between them that has the roles).
Is there any way that I can set this roles to user in manager basing for example on object's id from URL?
Looks like you're looking for ACL: http://symfony.com/doc/current/cookbook/security/acl.html