Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Controller now use trait for better use in EasyAdmin #176

Merged
merged 5 commits into from
Mar 9, 2020

Conversation

DylanKas
Copy link
Contributor

@DylanKas DylanKas commented Mar 5, 2020

This pull request modify the EasyAdminController to use a trait and make it easier to use other extension with EasyAdmin. (Example: WandiParis/EasyAdminPlusBundle)

It has been tested on a local projet that use both Wandi and AlterPHP extensions.

use Wandi\EasyAdminPlusBundle\Controller\AdminController as WandiController;
use AlterPHP\EasyAdminExtensionBundle\Controller\AdminExtensionControllerTrait as AlterPHPTrait;

class CustomAdminController extends WandiController
{
    use AlterPHPTrait;
    //....
}

I will try to contact other developer such as Wandi to try and do the same and it will make it better for EasyAdmin users to use multiple extensions.

@DylanKas
Copy link
Contributor Author

DylanKas commented Mar 5, 2020

I contacted the author of Wandi Extension Bundle and he accepted a similar PR so now it's very easy to use both extension :

use EasyCorp\Bundle\EasyAdminBundle\Controller\EasyAdminController;
use Wandi\EasyAdminPlusBundle\Controller\AdminControllerTrait as WandiTrait;
use AlterPHP\EasyAdminExtensionBundle\Controller\AdminExtensionControllerTrait as AlterPHPTrait;

class CustomAdminController extends EasyAdminController
{
    use AlterPHPTrait;
    use WandiTrait;
    
    //...
}

Now it's very easy to use both extension, I just had to override the isActionAllowed used by both extensions and everything is working fine.

@alterphp alterphp self-requested a review March 5, 2020 14:54
src/Controller/EasyAdminController.php Outdated Show resolved Hide resolved
src/Controller/EasyAdminController.php Outdated Show resolved Hide resolved
@alterphp
Copy link
Owner

alterphp commented Mar 6, 2020

Thank you @DylanKas for this useful work !

For now it's on master, i'll tag it soon.

@alterphp alterphp merged commit 3b66079 into alterphp:master Mar 9, 2020
@alterphp
Copy link
Owner

alterphp commented Mar 9, 2020

@DylanKas I was sure I merged it 3 days ago but I did not... It's merged to master now.

@DylanKas
Copy link
Contributor Author

DylanKas commented Mar 9, 2020

It's fine :) Will you tag it soon ?

@alterphp
Copy link
Owner

tagged as v3.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants