PHP code example of nucleos / sonata-auto-configure-bundle

1. Go to this page and download the library: Download nucleos/sonata-auto-configure-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nucleos / sonata-auto-configure-bundle example snippets


// bundles.php
return [
    //...
    Nucleos\SonataAutoConfigureBundle\SonataAutoConfigureBundle::class => ['all' => true],
];



namespace App\Admin;

use Nucleos\SonataAutoConfigureBundle\Attribute\Admin;
use App\Controller\Admin\CategoryController;
use App\Entity\Category;
use Sonata\AdminBundle\Admin\AbstractAdmin;

#[Admin(
    label: "Category",
    managerType: "orm",
    group: "Category",
    showInDashboard: true,
    showMosaicButton: true,
    keepOpen: true,
    onTop: true,
    icon: "<i class: 'fa fa-user'></i>",
    labelTranslatorStrategy: "sonata.admin.label.strategy.native",
    labelCatalogue: "App",
    translationDomain: "messages",
    pagerType: "simple",
    controller: CategoryController::class,
    entity: Category::class,
    adminCode: "admin_code",
    autowireEntity: true,
    templates: [
        "list" => "admin/category/list.html.twig"
    ],
    children: ["app.admin.product"]
)]
final class CategoryAdmin extends AbstractAdmin
{
}



namespace App\Admin;

use Nucleos\SonataAutoConfigureBundle\Attribute\AdminExtension;
use Sonata\AdminBundle\Admin\AbstractAdminExtension;

#[AdminExtension(
    global: true
)]
final class GlobalExtension extends AbstractAdminExtension
{
}



namespace App\Admin;

use Nucleos\SonataAutoConfigureBundle\Attribute\AdminExtension;
use Sonata\AdminBundle\Admin\AbstractAdminExtension;
use App\Admin\ActivityAdmin;

#[AdminExtension(
    target: ["app.admin.project", ActivityAdmin::class]
)]
final class SortableExtension extends AbstractAdminExtension
{
}