hackzilla-project / TicketBundle

Bundle provides multilingual ticketing functionality for Symfony applications.
http://hackzilla.org
MIT License
64 stars 43 forks source link

Trouble with PermissionManager and UserManager #253

Closed regisgrison closed 1 year ago

regisgrison commented 2 years ago

Hi,

Regarding a crash I had and that commit: https://github.com/hackzilla-project/TicketBundle/commit/595df4cb94d4abe57737da65a0c21a4c2fb26167

I wonder if the setUserManager() you added in UserManagerTrait.php should not be in PermissionManagerTrait.php

Anyway I have a fatal error if I don't add it to mine because of this in manager.php:


        ->set(PermissionManagerInterface::class)
            ->class('%hackzilla_ticket.manager.permission.class%')
            ->public()
            ->call('setUserManager', [
                new ReferenceConfigurator(UserManagerInterface::class),
            ])```
hackzilla commented 2 years ago

The idea of those traits was just to add getters/setters for those particular managers. Hackzilla\Bundle\TicketBundle\Manager\PermissionManager uses UserManagerTrait

It looks like I've messed up somewhere, as src/Manager/PermissionManager.php differs from my demo implementation https://github.com/hackzilla-project/TicketBundleDemoApp/blob/v4/src/Manager/TicketPermissionManager.php.

hackzilla commented 2 years ago

I should have looked more carefully at my code yesterday. TicketPermissionManager.php extends PermissionManager from the bundle.

You just need to add UserManagerTrait to your class. Maybe I should add the word Setter into the trait to make it more clear?

regisgrison commented 2 years ago

OK, I just understand that I had to use UserManagerTrait in my PermissionManager. I'll try it.

In fact I made xxxManager use xxxTrait and xxxInterface without thinking we could use another trait in it.